[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Hi,
because the 'preceding::' axis contains nodes as they reside in the document (not as they occur in a node-set), you cannot use that axis to determine uniqueness of the 2nd degree.
Tempore 07:58:45, die 02/16/2005 AD, hinc in xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit viswanath <murugappan.viswanath@xxxxxxxxxxxx>:
<xsl:for-each select="key('records',c)[generate-id(o) =generate-id(key('o',concat(c,o)))]">
regards,
--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041)
"CB&CB9CB;CB.CB:CB?CB?CB= CB5CB9CB=CB1CB9 CB<CB1CB;CB;CB?CB= CB7 Cb CB9CB;CECB;CB1CB;CB?CB=" - CE!CB;CB5CECB2CB?Cb&CB;CB?Cb
Re: [xsl] xsl transform flatfile to xml
Subject: Re: [xsl] xsl transform flatfile to xml From: "Joris Gillis" <roac@xxxxxxxxxx> Date: Thu, 17 Feb 2005 17:12:27 +0100 |
Hi,
because the 'preceding::' axis contains nodes as they reside in the document (not as they occur in a node-set), you cannot use that axis to determine uniqueness of the 2nd degree.
Tempore 07:58:45, die 02/16/2005 AD, hinc in xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit viswanath <murugappan.viswanath@xxxxxxxxxxxx>:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/> <xsl:key name="records" match="line" use="c"/>
add: <xsl:key name="o" match="o" use="concat(../c,.)"/>
replace with:<xsl:template match="/"> <results> <xsl:apply-templates select="output"/> </results> </xsl:template> <xsl:template match="output"> <xsl:for-each select="line[generate-id() = generate-id(key('records',c)[1])]"> <xsl:variable name="pos" select="position()"/> <comp id="{$pos}"> <c> <xsl:value-of select="c"/> </c> <xsl:call-template name="L2Interface"> <xsl:with-param name="parentid" select="$pos"/> </xsl:call-template> <xsl:call-template name="OSInterface"> <xsl:with-param name="parentid" select="$pos"/> </xsl:call-template> </comp> </xsl:for-each> </xsl:template> <xsl:template name="OSInterface"> <xsl:param name="parentid"/> <xsl:for-each select="key('records',c)[not(o = preceding::o)]">
<xsl:for-each select="key('records',c)[generate-id(o) =generate-id(key('o',concat(c,o)))]">
<xsl:variable name="index" select="position()"/> <o array="{$index}" parent="{$parentid}"> <name> <xsl:value-of select="o"/> </name> </o> </xsl:for-each> </xsl:template> <xsl:template name="L2Interface"> <xsl:param name="parentid"/> <xsl:for-each select="key('records',c)[not(l = preceding::l)]"> <xsl:variable name="index" select="position()"/> <l array="{$index}" parent="{$parentid}"> <name> <xsl:value-of select="l"/> </name> </l> </xsl:for-each> </xsl:template> </xsl:stylesheet>
regards,
--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041)
"CB&CB9CB;CB.CB:CB?CB?CB= CB5CB9CB=CB1CB9 CB<CB1CB;CB;CB?CB= CB7 Cb CB9CB;CECB;CB1CB;CB?CB=" - CE!CB;CB5CECB2CB?Cb&CB;CB?Cb
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] xsl transform flatfile to xml, viswanath | Thread | [xsl] RE: Display children of node , Adam J Knight |
Re: [xsl] XSLT and comma's in XML d, David Carlisle | Date | Re: [xsl] Adding element to xml sni, Joris Gillis |
Month |