Shifting nodes in an XML using XSLT
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 1
- Joined: Sun Nov 11, 2012 5:40 pm
Shifting nodes in an XML using XSLT
Hi guys,
I have an XML with following structure
<root>
<header>
<line>
<line>
<line>
<subline>
<subline>
<subline>
<root>
how can I transform the above xml to the following structure using XSLT?
<root>
<line>
<subline>
<line>
<subline>
<line>
<subline>
each line is connected with the appropriate subline using a tag id
Thanks in advance for your support.
I have an XML with following structure
<root>
<header>
<line>
<line>
<line>
<subline>
<subline>
<subline>
<root>
how can I transform the above xml to the following structure using XSLT?
<root>
<line>
<subline>
<line>
<subline>
<line>
<subline>
each line is connected with the appropriate subline using a tag id
Thanks in advance for your support.
-
- Posts: 1
- Joined: Tue Nov 20, 2012 11:41 am
Re: Shifting nodes in an XML using XSLT
Hi,
You can use :
Regards,
Lorela
You can use :
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="/root">
<xsl:copy>
<xsl:apply-templates select="line | subline">
<xsl:sort select="id"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Lorela
Lorela Stanescu
oXygen XML Editor and Author Support
oXygen XML Editor and Author Support
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