xsl-list
[Top] [All Lists]

[xsl] Problem with str:tokenize

2006-06-27 04:32:14
Hi
   I am having probelm with str:tokenize function. I run a for-each
loop on the str:tokenize() function. Inside the same I want to execute
another for-each loop.

To elaborate, I have the following xml file
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="myxsl.xsl"?>
<root>
        <path1>
                <info>
                        <name>Ryan,DDDD</name>
                        <age>26</age>
                        <dept>IT</dept>
                </info>
        </path1>
        <path2>
                <deptinfo>
                        <dept>IT</dept>
                        <name>Information Technology</name>
                </deptinfo>
                <deptinfo>
                        <dept>CompScience</dept>
                        <name>Computer Science</name>
                </deptinfo>
        </path2>
</root>

And the following xsl
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
        xmlns:str="http://exslt.org/strings";
        extension-element-prefixes="str">

      <xsl:template match="/">
              <head><title>Greeting</title></head>
                      <body>
                      <p>Words of greetingf:<br/>
                        <xsl:for-each 
select="str:tokenize(//root/path1/info/name,',')">
                                <b><i><u>Hello</u></i></b><br/>

                                        <xsl:for-each 
select="//root/path2/deptinfo">
                                                <b><i><u>Hello1</u></i></b><br/>
                                        </xsl:for-each>
                        </xsl:for-each>
                       </p>
                      </body>
      </xsl:template>
</xsl:stylesheet>

Ideally it should return me
Hello
Hello1
Hello1
Hello
Hello1
Hello1

but returns
Hello
Hello

i.e the inner for-each loop never gets executed. Any reason why this
happens and how to solve the same

Thanks
Sanket.

--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>