[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] regex stuff, last character being chomped


Subject: [xsl] regex stuff, last character being chomped
From: "Ihe Onwuka ihe.onwuka@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 30 Oct 2014 09:47:57 -0000

Transforming some text like this which is a director and movie title
separated by a tab delimiter.

&Oumlzkul, Ahmet Salih Ii (2013)

with

  <xsl:template name="main">
    <directors>
     <!-- process a line of text at a time -->
     <xsl:for-each
select="tokenize(unparsed-text('directors.list','iso-8859-1'),'.\n')">
       <!-- deal with tab delimiter -->
       <xsl:variable name="lineSplit"
select="tokenize(.,'\t')[normalize-space(.)]"/>
       <xsl:if test="count($lineSplit) eq 2">
         <director>
           <xsl:value-of select="normalize-space($lineSplit[1])"/>
         </director>
       </xsl:if>
       <movie>
         <xsl:value-of select="$lineSplit[last()]"/>
       </movie>
     </xsl:for-each>
    </directors>
  </xsl:template>

and am getting

   <director>&amp;Oumlzkul, Ahmet Salih</director>
   <movie>Ii (2013</movie>

i.e the closing bracket of what should be the movie text node is missing.


Current Thread