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

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -