xsl-list
[Top] [All Lists]

[xsl] regex stuff, last character being chomped

2014-10-30 04:48:11
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.
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--
<Prev in Thread] Current Thread [Next in Thread>