Mat,
You were on the right track using the tokenize function, you just need to
capture the result of the template call. What you need to do is wrap your
call-template call in a variable and then use the node-set extension function to
do work on those newly created nodes.
For example,
<xsl:variable name="siteNodes">
<xsl:call-template name="tokenize">
<xsl:with-param name="string" select="@exsites" />
<xsl:with-param name="delimiters" select="','" />
</xsl:call-template>
</xsl:variable>
Will create a variable with the structure:
<exsite>17</exsite>
<exsite>21</exsite>
<exsite>32</exsite>
You then need to use the node-set extenstion function of your XSLT processor.
If you are using MSXML it would look like:
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt">
...
<xsl:for-each select="msxml:node-set($siteNodes)/exsite">
Do something here
</xsl:for-each>
</xsl:stylesheet>
If you're on a different processor you'll have to look up the correct namespace
URI for the processor.
Hope this helps.
-Peter
-----Original Message-----
From: Mat Bergman [mailto:matbergman(_at_)yahoo(_dot_)com]
Sent: Thursday, June 09, 2005 1:12 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Process node set generated by EXSLT tokenize
I built a simple XSL stylesheet for a css-based
sidebar navigation. The navigation will appear on
several co-branded sites, so each link's XML element
has an attribute that specifies the link's display
status. For example:
<menu name="name" url="" includeSites="0"/>
I use an <xsl:if> statement to compare the attribute
against a "siteID" parameter. If there's a match, then
the link is displayed. A <xsl:for-each> iterates
through each link. No problem.
My project has a new requirmenet. The includeSites
attribute may have muliple, comma-delimited values.
For example:
<menu name="name" url="" includeSites="17,21,32"/>
I utilized the EXSLT tokenize() template to build a
node set out of the delimited attributes. However, I'm
new to XSLT and I can't grasp how to process that node
set. This is the XHTML that my stylesheet is currently
generating:
<ul><includeSite>0</includeSite><li><a href="">Link
1</a></li><includeSite>17</includeSite><li><a
href="">Link 2</a></li>...</ul>
What I want is for the node set values to be passed to
an <xsl:if> statement that's iterated by an
<xsl:for-each>, like I have in my single-attribute
version. If this were JavaScript, I would pass the
node value as a variable, but that doesn't seem
possible in XSLT.
I have examples of my code posted if my language isn't
clear:
http://www.matbergman.com/misc/xmlNav/
Is this task even within the capabilities of XSLT 1.0?
Thanks,
-Mat
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--