[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] docbook testing
Keith Fahlgren wrote:
> > BTW, I only see replace() as being XPath 2.0-specific, and
> > this particular usage could be easily rewritten using
> > translate().
> I'm sure you're right. Patches welcome.
Replace:
<xsl:template match="text()">
<xsl:value-of select="replace(replace(., '[a-z]', 'x'), '[0-9]', 'd')"/>
</xsl:template>
by:
<xsl:variable name="alph" select="
concat('abcdefghijklmnopqrstuvwxyz',
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'1234567890')"/>
<xsl:variable name="repl" select="
concat('xxxxxxxxxxxxxxxxxxxxxxxxxx',
'xxxxxxxxxxxxxxxxxxxxxxxxxx',
'dddddddddd')"/>
<xsl:template match="text()">
<xsl:value-of select="translate(., $alph, $repl)"/>
</xsl:template>
Hope that helps,
--
Florent Georges
http://www.fgeorges.org/
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]