Subject: Re: [xsl] Newbie question on XSL transformations: multiple sorts on element attributes From: Rob Newman <rlnewman@xxxxxxxx> Date: Tue, 6 Feb 2007 13:19:25 -0800 |
{hostname} 273%> xsltproc -v -o output.xml transform.xsl input.xml creating dictionary for stylesheet reusing dictionary from transform.xsl for stylesheet Added namespace: xsl mapped to http://www.w3.org/1999/XSL/Transform Segmentation fault {hostname} 274%>
-- START SNIPPET --
<xsl:template match="dataloggerlist">
<xsl:element name="dataloggerlist">
<xsl:apply-templates select="datalogger">
<xsl:sort select="param/@id{dlt}" data-type="number" order="descending" />
<xsl:sort select="@name" order="ascending" />
</xsl:apply-templates>
</xsl:element>
</xsl:template>
-- END SNIPPET --
(Note: the datalogger template outputs the data same as before)
This is very strange, as it cannot possibly run, you have a syntax error in your select clause (if you did manage to get it running, can you follow-up with the processor you are using?). The following is in error:
<xsl:sort select="param/@id{dlt}" data-type="number" order="descending" />
Change it to:
<xsl:sort select="param[@id = 'dlt']" />
and all elements with @id = 'dlt' (i.e., attribute nodes containing the exact match to the text 'dlt') will be output firstly.
-- START SNIPPET -- <xsl:template match="dataloggerlist"> <xsl:element name="dataloggerlist"> <xsl:apply-templates select="datalogger"> <xsl:sort select="param[@id = 'dlt']" /> </xsl:apply-templates> </xsl:element> </xsl:template> -- END SNIPPET --
I would prefer to do this whole process in one step, and avoid having two XSL files that create an interim XML file that just gets transformed again.
and you are right, you won't need to.
Thanks again, - Rob
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Newbie question on XSL tr, Abel Braaksma | Thread | Re: [xsl] Newbie question on XSL tr, Abel Braaksma |
[xsl] Dynamically calling a templat, Steve | Date | Re: [xsl] Newbie question on XSL tr, Abel Braaksma |
Month |