Hello all, I try to sort the year field in my xml file using <xsl:sort> by following link but I'm not getting the desired result. Here is my sorting code:
And my xml file consists of tags:
And my schema elements
<xsd:element name="name" type="xsd:string" />
<xsd:element name="description" type="xsd:string" />
<xsd:element name="impl_year" type="xsd:year" />
Then when I load the xml file, 1) I don't see anything and 2) if I have the templates but use <xsl:for-each> tag, then my data isn't sorted. What's going on? Thanks
First of all, the <xsl:apply-templates> causes XSLT to process the children of the "system" elements. Those are "name" elements according to your description of the XML. Do you have a template that does that? (I don't see one but maybe you didn't post it.) If not, do you know what XSLT's default processing rule is for an element?
Second, the <xsl:sort> element specifies the sequence for processing those "name" elements. According to your description of the XML, they don't have "impl_year" elements as their children so the sorting won't do anything.