wahrusakiki 0 Newbie Poster

Greetings everyone,

My name is Tommy,

Based on the tutorial codes written by hol.sten (http://user.services.openoffice.org/en/forum/viewtopic.php?t=3490&f=45), i've tried to write similar codes for the same purposes, but with an added complexity.

I encounter quite a problem when i tried to export the Ooo calc ods file. The problem lies in one of the column in Ooo calc ods file whereas in a cell i got some strings that need to be tokenized.

example :
------------------------
| tags |
------------------------
| blue, red, yellow |
------------------------

the output i want is as follows :

<tag> blue </tag>
<tag> red </tag>
<tag> yellow </tag>

the output given by the tutorial examples above is as follows

<tag> blue, red, yellow </tag>

i've tried to write codes similar to the one taught from the tutorial, but alas, i'm sucks at xslt since i don't know how to write it correctly, here is my code regarding the example i've given above :

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
   xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
   xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
   exclude-result-prefixes="office table text">

<xsl:template match="table:table">
    <xsl:for-each select="table:table-row">
            <xsl:for-each select="table:table-cell">
                   <xsl:choose>
                           <xsl:when test="position()=6">
                                      <xsl:variable name="tagList">
                                             <xsl:value-of select="text:p"/>
                                      </xsl:variable>
                            <xsl:variable  name="counter">0</xsl:variable>
                            <xsl:variable name="tokenizedTagList"  
                                     select="tokenize($tagList,',')"/>
                             <xsl:for-each select="$tokenizedTagList">
                                  <tag>
                              <xsl:value-of select="item-
                                   at($tokenizedSample,counter)"/>
                                  </tag>
                                counter = counter + 1
                            </xsl:for-each>
</xsl:when>
</xsl:choose>
</xsl:for-each>

Can anyone help me in correcting the codes above?
Thanks in advance, Tommy.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.