xsl-list
[Top] [All Lists]

RE: [xsl] XSL Remove part of a text inside TAG

2008-03-07 09:17:49
 Actually I want ONLY to remove a path from this tag,

<FontFace>D:\Work\Phase III\Executables\Fonts\TIMESNRO.FNT</FontFace>

In final xml file I want to appear it as this,

<FontFace>TIMESNRO.FNT</FontFace>


In XSLT 2.0

<xsl:template match="FontFace">
  <xsl:value-of select="tokenize(., '\\')[last()]"/>
</xsl:template>

In XSLT 1.0 you need to use recursion. You write a recursive named template
that takes the filename as input. If the filename contains "\", then make a
recursive call, supplying substring-after($in, '\') as the parameter value.
If it doesn't contain "\", return the input value as the result.

Michael Kay
http://www.saxonica.com/


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--