[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Identifying unique attribute values in nested
As always, clear and to the point. Thanks, Mark -----Original Message----- From: G. Ken Holman Sent: Tuesday, October 04, 2011 5:50 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: Identifying unique attribute values in nested sibling elements At 2011-10-04 07:23 -0700, Mark wrote: Despite my confused presentation of the problem last week, you supplied me with two functions that obtain the unique attributes from <Value> element within a set of <Stamp> elements. Works beautifully, but I did make some modifications to the second function. Please let me know if my modifications are consistent with the idiom you have been talking about or if I have slipped back into C++. You have made one slip to note. <!-- kc-value + h-value --> <xsl:when test="Value/@h-value"> <xsl:variable name="h"> <xsl:for-each select="Value/@h-value"> <xsl:value-of select="."/> </xsl:for-each> </xsl:variable>
The above could simply be: <xsl:variable name="h" select="Value/@h-value"/> Then you are simply pointing to the existing node in the tree and getting that node's value at each reference. And since the node is an attribute node, the node's value is self-contained and no calculations or tree traversals are needed (as is true for obtaining an element's value or a document node's value which was true for your attempt). </xsl:text><xsl:for-each select="Value/@kc-value"> <xsl:choose> <xsl:when test="not(. eq '0')"> <a class="button" href="../aval/{concat(., '-', $h)}.htm"> <xsl:value-of select="concat(., '.', $h)"/> <xsl:text>KD </a> </xsl:when> <xsl:otherwise> <a class="button" href="../aval/{concat(., '-', $h)}.htm"> <xsl:value-of select="$h"/> <xsl:text>h</xsl:text> </a> </xsl:otherwise> </xsl:choose> </xsl:for-each>
</xsl:when> I would have used: href="../aval/{.}-0.htm" I hope this helps. . . . . . . . . . . . Ken -- Contact us for world-wide XML consulting and instructor-led training Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Google+ profile: https://plus.google.com/116832879756988317389/about Legal business disclaimers: http://www.CraneSoftwrights.com/legal
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|