[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Stripping white space
I have the following XSLT which handles Authors, i.e.
<AU>Smith, J.P.<AU> <AU>Jahan, Aras^Jones, Jimmy C.</AU> <--- delimited by '^' My problem is that I am breaking apart the individual authors using substring breaking apart by comman, so in the output I am getting: <surname>Smith</surname> <given-names> J.P.</given-names> <--- has a space before the J I tried using the normalize-space function which I understood would strip leading and trailing white space, but it isn't working. Probably a better way to do this is using patterns, and I will probably change it but I wanted to know if there's a way to strip the whitespace. My xslt is as follows: <xsl:template match="AU"> <contrib contrib-type="author"> <xsl:choose> <!-- Tests for Multiple Authors --> <xsl:when test="contains(., '^')"> <xsl:for-each select="tokenize(.,'\^')"> <xsl:choose> <xsl:when test="contains(.,',')"> <name> <surname> <xsl:value-of select="substring-before(normalize-space(.),',')"/> </surname> <given-names> <xsl:value-of select="substring-after(normalize-space(.),',')"/> </given-names> </name> </xsl:when> </xsl:choose> </xsl:for-each> <!-- <xsl:message terminate="yes"/> --> </xsl:when> <!-- Tests for singular author --> <xsl:when test="matches (.,',{1}')"> <name> <surname> <xsl:value-of select="substring-before(normalize-space(.),',')"/> </surname> <given-names> <xsl:value-of select="substring-after(normalize-space(.),',')"/> </given-names> </name> <!-- <xsl:message terminate="yes"></xsl:message> --> </xsl:when> <!-- Tests for empty AU field --> <xsl:when test="not(normalize-space(.))"> <xsl:message terminate="yes"></xsl:message> </xsl:when> <xsl:otherwise> <xsl:message terminate="yes"> <xsl:text>ABANDON SHIP! Arrrrrr ...</xsl:text> </xsl:message> --> </xsl:otherwise> </xsl:choose> </contrib> </xsl:template>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|