xslt 1.0 - transformation in particular sequence -


I would like to know that it is possible to move the XML element up and down in the element element.

Input xml.

  & lt; Root & gt; & Lt; A1 & gt; & Lt; / A1> & Lt; B1 & gt; B & lt; / B1> & Lt; C1 & gt; C & lt; / C1> & Lt; D1 & gt; D & lt; / D1> & Lt; / Root & gt;  

Required output xml

  & lt; Root & gt; & Lt; A1 & gt; & Lt; / A1> & Lt; D1 & gt; D & lt; / D1> & Lt; B1 & gt; B & lt; / B1> & Lt; C1 & gt; C & lt; / C1> & Lt; / Root & gt;  

XSD sequence rule

  & lt; Xs: schema attribute default = "ineligible" elementfirm default = "qualified" xmlns: xs = "http: // www. W3.org/2001/XMLSchema"> & Lt; Xs: element name = "root" & gt; & Lt; XS: complexType & gt; & Lt; XS: Sequence & gt; & Lt; Xs: element type = "x: string" name = "A1" /> & lt; Xs: element type = "x: string" name = "d1" /> & Lt; Xs: element type = "xs: string" name = "b1" /> & Lt; Xs: element type = "xs: string" name = "c1" /> & Lt; / XS: sequence & gt; & Lt; / XS: complexType & gt; & Lt; / XS: element & gt; & Lt; / XS: Schema & gt;  

Can someone provide an XSLT example to do something like this? Thanks in advance for any help.

Martin Honanan helps me get answers from other positions, so answer to help others Thought to share, but still I am thinking that there is no other way to do this - according to this view, if XSD tag order changes, then it has to make changes in the XSL sequence.

  & lt; Xsl: stylesheet xmlns: xsl = "http://www.w3.org/1999/XSL/Transform" version = "2.0" & gt; & Lt; Xsl: output indent = "yes" /> & Lt; Xsl: template match = "node () | @ *" & gt; & Lt; XSL: Copy & gt; & Lt; Xsl: apply-select template = "node () | @ *" /> & Lt; / XSL: Copy & gt; & Lt; / XSL: Templates & gt; & Lt; Xsl: template match = "root" & gt; & Lt; Root & gt; & Lt; Xsl: Apply-Select Template = "A1" /> & lt; Xsl: Apply-Select Template = "D1" /> & lt; Xsl: Choose Apply-Templates = "C1" /> & Lt; Xsl: Choose Apply-Template = "B1" /> & Lt; / Root & gt; & Lt; / XSL: Templates & gt; & Lt; Xsl: template match = "A1" & gt; & Lt; A1 & gt; & Lt; Xsl: applied-template / & gt; & Lt; / A1> & Lt; / XSL: Templates & gt; & Lt; Xsl: template match = "b1" & gt; & Lt; B1 & gt; & Lt; Xsl: applied-template / & gt; & Lt; / B1> & Lt; / XSL: Templates & gt; & Lt; Xsl: template match = "c1" & gt; & Lt; C1 & gt; & Lt; Xsl: applied-template / & gt; & Lt; / C1> & Lt; / XSL: Templates & gt; & Lt; Xsl: template match = "d1" & gt; & Lt; D1 & gt; & Lt; Xsl: applied-template / & gt; & Lt; / D1> & Lt; / XSL: Templates & gt; & Lt; / XSL: stylesheet & gt;  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

lua - HowTo create a fuel bar -