Subject: RE: [xsl] concatenated key From: David.Pawson@xxxxxxxxxxx Date: Wed, 23 Apr 2003 12:29:56 +0100 |
Or, to avoid comparing only on the first attribute: <xsl:template match="node[node]"> <xsl:variable name="theseChildren"> <xsl:value-of select="dp:conc(.)"/> </xsl:variable> <xsl:message> <xsl:value-of select="$theseChildren"/> </xsl:message> <xsl:if test="some $x in (preceding-sibling::node | following-sibling::node) satisfies (dp:conc($x) = $theseChildren )"> <p> (I am <xsl:value-of select="@name"/>) <xsl:for-each select="following-sibling::node | preceding-sibling::node"> <xsl:message> ** <xsl:value-of select="dp:conc(.)"/> </xsl:message> <xsl:if test="dp:conc(.) = $theseChildren "> Match at No. <xsl:value-of select="position()"/>, <xsl:value-of select="@name"/> <br /> </xsl:if> </xsl:for-each> </p> </xsl:if> </xsl:template> <xsl:function name="dp:conc"> <xsl:param name="nd" /> <xsl:variable name="res" > <xsl:for-each select="$nd/node"> <xsl:value-of select="@name"/><xsl:if test="not(position() = last())"><xsl:text>,</xsl:text></xsl:if> </xsl:for-each> </xsl:variable> <xsl:result select="$res" as="xs:string"/> </xsl:function> Sligthly more accurate. HTH daveP > > <node name="Alpha"> > > <node name="a"/> > > <node name="b"/> > > </node> > > <node name="roman"> > > <node name="i"/> > > <node name="ii"/> > > </node> > > <node name="Alpha2"> > > <node name="a"/> > > <node name="b"/> > > </node> > > Beating Jeni to it for once :-) > In xslt 2 this is > > > > > <xsl:template match="node"> > <xsl:variable name="theseChildren" select="node/@name"/> > <xsl:if test="some $x in ../node/node/@name satisfies ($x = > $theseChildren)"> > <xsl:variable name="this" select="generate-id()"/> > (I am <xsl:value-of select="@name"/>) > <xsl:for-each select="../node"> > <xsl:if test="(node/@name = $theseChildren ) and > not(generate-id() = > $this)"> > Match at <xsl:value-of select="position()"/> <br /> > > </xsl:if> > </xsl:for-each> > </xsl:if> > </xsl:template> > > > HTH DaveP > > - > > NOTICE: The information contained in this email and any > attachments is > confidential and may be legally privileged. If you are not the > intended recipient you are hereby notified that you must not use, > disclose, distribute, copy, print or rely on this email's content. If > you are not the intended recipient, please notify the sender > immediately and then delete the email and any attachments from your > system. > > RNIB has made strenuous efforts to ensure that emails and any > attachments generated by its staff are free from viruses. However, it > cannot accept any responsibility for any viruses which are > transmitted. We therefore recommend you scan all attachments. > > Please note that the statements and views expressed in this email > and any attachments are those of the author and do not necessarily > represent those of RNIB. > > RNIB Registered Charity Number: 226227 > > Website: http://www.rnib.org.uk > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > - NOTICE: The information contained in this email and any attachments is confidential and may be legally privileged. If you are not the intended recipient you are hereby notified that you must not use, disclose, distribute, copy, print or rely on this email's content. If you are not the intended recipient, please notify the sender immediately and then delete the email and any attachments from your system. RNIB has made strenuous efforts to ensure that emails and any attachments generated by its staff are free from viruses. However, it cannot accept any responsibility for any viruses which are transmitted. We therefore recommend you scan all attachments. Please note that the statements and views expressed in this email and any attachments are those of the author and do not necessarily represent those of RNIB. RNIB Registered Charity Number: 226227 Website: http://www.rnib.org.uk XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] concatenated key, Jeni Tennison | Thread | RE: [xsl] concatenated key, I-Lin Kuo |
RE: [xsl] count of how many times a, Leena Kulkarni | Date | Re: [xsl] concatenated key, Jeni Tennison |
Month |