xslt - XML - Elements not outputting in desired order -


I want to change the object from which the elements are output. At present, he is shown this: "Mathematics: English: Science: ABA (GCSE); (GCSE);" I want a way of ordering it so that I can display it like this: "Mathematics: A (GCSE); English: B (GCSE); Science: A (GCSE); " I am a newbie with XML, please try not to show any further solutions if possible!

XML code:

  & lt; Xsl: template match = "education" & gt; & Lt; div style = "float: left;" & Gt; & Lt; xsl: Apply-Select Template = "Qualifications / Qualified" /> & Lt; xsl: apply-select template = "qualifications / grade" /> & Lt; xsl: Apply-Select Template = "Qualifications / Level" /> & Lt; / Div & gt; & Lt; / XSL: Templates & gt; & Lt; Xsl: Template Match = "Eligible" & gt; & Lt; span style = "color: gray; font-size: 15px; font-family: vardana;" & Gt; & Lt; Xsl: Select the value = "." /> Gt; & Lt; / Span & gt; & Lt; p1 & gt;: & lt; / P1> & Lt; / Xsl: Templates & gt; & Lt; Xsl: template match = "grade" & gt; & Lt; span style = "color: gray; font-size: 15px; font-family: vardana;" & Gt; & Lt; Xsl: value selection = "." / "& gt; & lt; / span & gt; & lt; p1 & gt; & lt; / p1 & gt; & lt; / XSL: Template & gt; & lt; xsl: Template Match =" Level "& gt; & lt; p1 & gt; (& lt; / p1 & gt; & lt; span style = "color: gray; font-size: 15px; font-family: varna;" & gt; & lt; xsl: Value selection = "." /> Gt;  )    

XML code:

  > lt; qual & gt; math & lt; / qual & gt; & lt; grade & gt; & lt; / grade> gt; Level> gtc & gt; Level & gt; & lt; qual & gt; English & lt; / qual & gt; & lt; Grade & gt; B & lt ; / Grade & gt; & lt; Level & gt; GCSE & lt; / Level & gt; & lt; qual & gt; Science & lt; / qual & gt; & lt; Grade & gt; & lt; / grade & gt; Level & gt; GCSE & lt; / Level & gt; & Lt; / qualification & gt;    

You must first specify all the qual children, then each grade , then each level and applying the template that you should expect from it, instead of just copying your < code> Education template:

  & lt; Xsl: template match = "education" & gt; & Lt; div style = "float: left;" & Gt; & Lt; xsl: Apply-Select Template = "Qualifications / *" /> & Lt; / Div & gt; & Lt; / XSL: Templates & gt;   

In this document order, the templates apply to all types of children (such as orders appearing in the document) on qualification . There is no need of loop or select special siblings. Let the XSLT processor work for you.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -