[Home] [By Thread] [By Date] [Recent Entries]
Hi again,
Maybe I am going about this the wrong way. Perhaps there is a simpler XSLT/java way? I have a multi select list box that lists the contents of a folder on a web site. This list is the labels (with the value being the corresponding ID) that would appear in a nav. The user moves folder items up and down to change the order in which they are displayed in the nav. On submit i get a comma delimted String of IDs that I split on the server to make the nodeset I am passing to the transformation. The transformation loops on the nodeset passed in and reorders the folder, like so: <xsl:param name="nav_order"/> <xsl:template match="folder"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:choose> <xsl:when test="@id=$nav_order/order/@id"> <xsl:variable name="current_nodeset" select="."/> <xsl:for-each select="$nav_order/order/item"> <xsl:variable name="id" select="@id"/> <xsl:apply-templates select="$current_nodeset/*[@id=$id]" mode="sorted"/> </xsl:for-each> </xsl:when> <xsl:otherwise> <xsl:apply-templates/> </xsl:otherwise> </xsl:choose> </xsl:copy> </xsl:template> <xsl:template match="folder | page | col" mode="sorted"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:apply-templates/> </xsl:copy> </xsl:template> <xsl:template match="node()|@*"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:apply-templates/> </xsl:copy> </xsl:template> Is there a better way to do this? best, -Rob J.Pietschmann wrote: Robert Koberg wrote: XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|

Cart



