Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: variables [Thread Next] Re: variablesTo: NULL Date: 4/3/2007 4:16:00 PM RedLars wrote: > Could you possibly show me a code example (or pseudo code) of how > you'd solve this problem. Assuming your are using MSXML or .NET as your XSLT processor you have an extension function msxsl:node-set that converts a result tree fragment into a node set so that you can apply XPath on it (without needing to chain transformations). So you would do e.g. <xsl:variable name="rtf"> <xsl:for-each select="computer"> <xsl:sort select="@number" data-type="number"/> <xsl:copy-of select="."/> </xsl:for-each> </xsl:variable> then apply the node-set function e.g. <xs:variable name="sorted-computers" select="msxsl:node-set($rtf)" xmlns:msxsl="urn:schemas-microsoft-com:xslt"> then do the rest e.g. <xsl:for-each select="$sorted-computers/computer"> <a href="#{generate-id()}"><xsl:value-of select="@type"/><xsl:number value="@number" format="001"/></a> <xsl:value-of select="concat(' floor: ', floor(@number div 10))"/> <xsl:value-of select="concat(' floor_sib: ', floor(following- sibling::node()[1]/@number div 10))"/> <xsl:value-of select="concat(' floor_num: ', (following- sibling::node()[1]/@number))"/> <xsl:if test="floor(@number div 10) != floor(following-sibling::node() [1]/@number div 10)"> <br/> </xsl:if> -- Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
