docbook-apps

recursive string escaping and custom namespace

  • 1.  recursive string escaping and custom namespace

    Posted 01-07-2007 15:06
    i'm writing a stylesheet to convert docbook files into wiki text and at the
    moment i'm trying to write an extensible escaping function but having trouble
    with the custom namespace usage ... in other words, i want to take some
    arbitrary text (like in <para> tags which could be just about anything) and
    make sure i escape all the reserved wiki stylings

    so if i had:
    <para>blah lah __function blah</para>
    i'd escape it to:
    <para>blah lah %%__%%function blah</para>

    rather than just calling out to replace-string for every such format
    ('__' -> '%%__%%'), i'm trying to hide all of this wiki stuff in a sep file

    i'm using this for the actual replace-string function:
    http://aspn.activestate.com/ASPN/Cookbook/XSLT/Recipe/65426

    and the attached .xsl is my attempt at writing a wiki escape function ... idea
    being i would use it like:
    <xsl:template match="para">
    <xsl:call-template name="dokuwiki-escape">
    <xsl:with-param name="text" select="normalize-space(.)" />
    </xsl:call-template>
    ...
    </xsl:template>

    i know i'm missing something basic because i just started learning xsl
    yesterday ;x
    -mike