xslt - xsl take path and substring the value -
i have xsl path gives me desired value:
/path/to/@value
is there way combine substring?
substring(/path/to/@value, 1, 5)
the preceding statement not work because i'm not familiar xsl thought
actually, should work fine:
xml:
<?xml version='1.0'?> <path> <to value='123456'/> </path>
xslt:
<?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" > <xsl:template match="/"> <out> <xsl:value-of select='substring(/path/to/@value, 1, 5)'/> </out> </xsl:template> </xsl:stylesheet>
another way use intermediate variable:
<xsl:variable name='t' select='/path/to/@value'/> <xsl:value-of select='substring( $t, 1, 5 )'/>
Comments
Post a Comment