xml - Shifting row data in xsl 1.0 -


After

I have multiple rows of data in my XML like this -

    

I have to display my output in the image, as if this row data works in each loop. And the requirement is that ROW TYPE = "TOTAL" id = "1" should first be displayed with its ROW TYPE = "SPECIFICATION" data then moving forward in the loop, line type = "total" id = "2" first to be displayed So its line type = "specification" data

Basically it should come in this way -.

 Code1 English 1 Mathematics 1 Code 2 English 2 Math 2   

For the XSLT code sequence -2 works for ech loop functions. But I need to move the first row for that ID, suggest the argument for it.

this change :

  Lt; Xsl: stylesheet version = "1.0" xmlns: xsl = "http://www.w3.org/1999/XSL/Transform" & gt; & Lt; Xsl: output omit-xml-declaration = "yes" indent = "yes" /> & Lt; Xsl: strip-space element = "*" /> & Lt; Xsl: key name = "kRowById" match = "ROW [no (@ TYPE = 'TOTAL')]" use = "@ id" /> & Lt; Xsl: template match = "ROW [@ TYPE = 'TOTAL']" & gt; & Lt; Xsl: copy-of select = "." / & Gt; & Lt; Xsl: copy-of select = "key ('kRowById', @ID)" /> & Lt; / XSL: Templates & gt; & Lt; Xsl: template match = "text ()" /> & Lt; / XSL: stylesheet & gt;   

When applied to the provided XML (well-formed XML document for wrapping in a top element):

  & lt; T & gt; & Lt; ROW TYPE = "SPECIFICATION" id = "1" & gt; & Lt; R1 & gt; English1 & lt; / R1 & gt; & Lt; / Row & gt; & Lt; ROW TYPE = "SPECIFICATION" id = "1" & gt; & Lt; R1 & gt; Maths1 & lt; / R1 & gt; & Lt; / Row & gt; & Lt; ROW type = "TOTAL" id = "1" & gt; & Lt; R1 & gt; Code1 & lt; / R1 & gt; & Lt; / Row & gt; & Lt; ROW TYPE = "SPECIFICATION" id = "2" & gt; & Lt; R1 & gt; English2 & lt; / R1 & gt; & Lt; / Row & gt; & Lt; ROW TYPE = "SPECIFICATION" id = "2" & gt; & Lt; R1 & gt; Maths2 & lt; / R1 & gt; & Lt; / Row & gt; & Lt; ROW type = "TOTAL" id = "2" & gt; & Lt; R1 & gt; Code2 & lt; / R1 & gt; & Lt; / Row & gt; & Lt; / T & gt;   

produces the desired result (in which the desired elements are re-ordering:

  line type = "Total" id = "1">  Code1      Code2   & lt; line & lt; Car = "specification" id = "2">  English2    Mathematics 2      

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -