Problems with Automatic editing of endtags
Oxygen general issues.
-
- Posts: 1
- Joined: Mon Mar 22, 2010 7:46 pm
Problems with Automatic editing of endtags
Hello,
I am trying to convert an xml document element tags.
My original XML consists of the following:
<element name='File' >CrimeReport_010609-011209.txt</element>
<element name='CrimeNumber' >10032009.201720.309.CFC</element>
...
I would like to change it to the following:
<File>CrimeReport_010609-011209.txt</File>
<CrimeNumber>10032009.201720.309.CFC</CrimeNumber>
I am able to change the <element name = ' '> tag using the Find/Replace however the endtag is not automatcally changing.
IS there some way to automatically change the endtags throughout the document?
Or use Find/Replace in a different manner?
Thanks,
Mike
I am trying to convert an xml document element tags.
My original XML consists of the following:
<element name='File' >CrimeReport_010609-011209.txt</element>
<element name='CrimeNumber' >10032009.201720.309.CFC</element>
...
I would like to change it to the following:
<File>CrimeReport_010609-011209.txt</File>
<CrimeNumber>10032009.201720.309.CFC</CrimeNumber>
I am able to change the <element name = ' '> tag using the Find/Replace however the endtag is not automatcally changing.
IS there some way to automatically change the endtags throughout the document?
Or use Find/Replace in a different manner?
Thanks,
Mike
-
- Site Admin
- Posts: 2097
- Joined: Thu Jan 09, 2003 2:58 pm
Re: Problems with Automatic editing of endtags
The best tool to make such processing is XSLT. For example you can start with a recursive copy template and add a rule that matches element elements and creates a new element with the name specified in the name attribute:
on an input like
gives
If you still need a solution based on find and replace let us know.
Best Regards,
George
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="element">
<xsl:element name="{@name}"><xsl:apply-templates/></xsl:element>
</xsl:template>
</xsl:stylesheet>
Code: Select all
<test>
<element name="File">CrimeReport_010609-011209.txt</element>
<element name="CrimeNumber">10032009.201720.309.CFC</element>
</test>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<test>
<File>CrimeReport_010609-011209.txt</File>
<CrimeNumber>10032009.201720.309.CFC</CrimeNumber>
</test>
Best Regards,
George
George Cristian Bina
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service