i want to change element name
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 3
- Joined: Mon Jan 21, 2008 9:25 am
i want to change element name
Post by s.amitsaini »
i want to change element name......
i have xml file like that
<Project>
<Body>
<Title>
<TXT>Inside Title</TXT>
</Title>
<PLITEM>
<TXT>InSide The PLItem</TXT>
</PLITEM>
</Body>
</Project>
i want to change the name of element<PLITEM> to <ITEM>...want the output like that.....
<Project>
<Body>
<Title>
<TXT>Inside Title</TXT>
</Title>
<ITEM>
<TXT>InSide The PLItem</TXT>
</ITEM>
</Body>
</Project>
how its possible....?
i have xml file like that
<Project>
<Body>
<Title>
<TXT>Inside Title</TXT>
</Title>
<PLITEM>
<TXT>InSide The PLItem</TXT>
</PLITEM>
</Body>
</Project>
i want to change the name of element<PLITEM> to <ITEM>...want the output like that.....
<Project>
<Body>
<Title>
<TXT>Inside Title</TXT>
</Title>
<ITEM>
<TXT>InSide The PLItem</TXT>
</ITEM>
</Body>
</Project>
how its possible....?
-
- Posts: 51
- Joined: Fri Jan 27, 2006 12:51 am
Re: i want to change element name
Try using the (untested) XSLT below
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!-- The identity transform -->
<xsl:template match="/ | @* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="PLITEM">
<xsl:element name="ITEM">
<xsl:apply-templates select="@* | node()"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!-- The identity transform -->
<xsl:template match="/ | @* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="PLITEM">
<xsl:element name="ITEM">
<xsl:apply-templates select="@* | node()"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ 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