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/





---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to