Subject: Re: [xsl] [XSL] Calculating Length of String Variables From: jingjun long <longjingjun@xxxxxxxxx> Date: Thu, 13 Sep 2007 11:07:30 +0800 |
<xsl:template match="graphic"> <xsl:value-of select="string-length(@url)"/> </xsl:template>
<xsl:template match="graphic"> <xsl:variable name="image_src"> <xsl:value-of select="./@url"/> </xsl:variable> <xsl:value-of select="string-length($image_src)"/> </xsl:template>
Hi,
I am trying to create different sets of output based on the length of the "string" of my variable. Below are the lines I used for calculation:
<xsl:variable name="image_src"> <xsl:value-of select="./@url"/> </xsl:variable>
<xsl:template match="graphic"> <xsl:value-of select="string-length($image_src)"/> </xsl:template>
If I have XML like: <graphic url="0125"/>. the result is supposed to come out with 4. And, likewise, <graphic url="123456"/> should come out with 6. However, when I run the XSLT, it only gives me "0". Is there something I have done wrong?
Thanks to those who may help.
Alice
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] [XSL] Calculating Length of S, Alice Wei | Thread | RE: [xsl] [XSL] Calculating Length , Michael Kay |
[xsl] [XSL] Calculating Length of S, Alice Wei | Date | Re: [xsl] Smart Quote Encoding, Deborah Pickett |
Month |