Yes, this works. In XSLT 2.0 you could write more concisely:
<xsl:template match="/root/service_discovery/ip">
  <ip v="{@v}">
    <xsl:variable name="portlist" select="tokenize(ports, ',')"/>
    <xsl:variable name="resultlist select="tokenize(results, ',')"/>
    <xsl:for-each select="1 to count($portlist)">
       <portresults p="{$portlist[current()]}" r="{$resultlist[current()]}"/>
Michael Kay

From: [] On Behalf Of Namrata Patel
Sent: 15 March 2005 19:12
Subject: [saxon] RE: tokenize



            Thanks for your quick reply. The reason I asked this was because I wanted to iterate through the nodes of two tokenize result node-sets and I was getting confused as to how would I write my xsl. I have come up with the following xsl which works ok. Does the xsl make sense to you or you would do it some other way?? I am very new to xsl ( 1 month ), which you can see from my xsl.


<xsl:template match="/root/service_discovery/ip">


        <xsl:variable name="row" select="." />



            <xsl:element name="ip">


            <xsl:attribute name="v"><xsl:value-of select="$row/@v"/></xsl:attribute>


            <xsl:variable name="portlist" select="saxon:tokenize($row/ports,',')"/>

            <xsl:variable name="resultlist" select="saxon:tokenize($row/results, ',')"/>


            <xsl:for-each select="$portlist">

                <xsl:element name="portresults">

                <xsl:variable name="count" select="position()" />

                <xsl:variable name="result" select="$resultlist[$count]"/>

                <xsl:attribute name="p"><xsl:value-of select="."/></xsl:attribute>

                <xsl:attribute name="r"><xsl:value-of select="$result/."/></xsl:attribute>               






Thanks again for your quick response