docbook-apps

  • 1.  find/replace in title

    Posted 04-30-2012 22:44
    I'm trying to do a find replace in the title of my docbook (the title is
    dynamically generated and if it has certain words in there, I want to
    replace them), but I'm not sure how to go about this. In the
    titlepage.xsl, I have tried replacing



    <xsl:element name="xsl:copy-of">

    <xsl:attribute name="select"> $recto.content</xsl:attribute>

    </xsl:element>



    with



    <xsl:element name="xsl:copy-of">

    <xsl:attribute
    name="select">translate($recto.content,"'FindMe'","'ReplaceMe'")</xsl:at
    tribute>

    </xsl:element>



    This ends up producing all sorts of garbage objects, and I suspect this
    is because I have a mediaObject on my title page.



    I'm really just trying to do the find/replace inside the title tags of
    my docbook xml. Can someone point me in the right direction on this?



    Thanks,

    Jeff






  • 2.  Re: [docbook-apps] find/replace in title

    Posted 05-01-2012 12:18
    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Hi Jeff,
    In xslt 1.0, you'll need to use a recursive template for that. Here's
    an example:

    http://www.dpawson.co.uk/xsl/sect2/replace.html#d8770e61

    If you can do a xslt 2.0 preprocessing step, then you can use
    replace() and regular expressions.

    David


    On 04/30/2012 05:43 PM, Jeff Storey wrote:
    > I?m trying to do a find replace in the title of my docbook (the
    > title is dynamically generated and if it has certain words in
    > there, I want to replace them), but I?m not sure how to go about
    > this. In the titlepage.xsl, I have tried replacing
    >
    >
    >
    > <xsl:element name="xsl:copy-of">
    >
    > <xsl:attribute name="select"> $recto.content</xsl:attribute>
    >
    > </xsl:element>
    >
    >
    >
    > with
    >
    >
    >
    > <xsl:element name="xsl:copy-of">
    >
    > <xsl:attribute
    > name="select">translate($recto.content,"'FindMe'","'ReplaceMe'")</xsl:attribute>
    >
    >
    >
    > </xsl:element>
    >
    >
    >
    > This ends up producing all sorts of garbage objects, and I suspect
    > this is because I have a mediaObject on my title page.
    >
    >
    >
    > I?m really just trying to do the find/replace inside the title tags
    > of my docbook xml. Can someone point me in the right direction on
    > this?
    >
    >
    >
    > Thanks,
    >
    > Jeff
    >
    >
    >

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.11 (GNU/Linux)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

    iQEcBAEBAgAGBQJPn9RbAAoJEMHeSXG7afUh0+UH/j01UQ2oubdvTEg9xwSWF1WL
    XshbBZZ2tp0ZyJiGhcE2DYkJagNHln5KIVsZTTuISnKmHcSy6Hn9p7yp4ttzpMU+
    9n7sNPTrh+xK2NFPkem8+WgDXbvsVC73eaTnKmLgad4Hd80M5j4ujqNYsXsChHrx
    TDPBNK7vr/37ejUMqcG5Oet20dXS0cOE3/hsjYkCxWVKG/JmPd9DA05X+4SlugiA
    UbFd+KdbYX2biDPrxx3PSTa9lp50nqSVNooHdOay2bxZtJmA5KRymcgq6drRmKH8
    2c5GTB6/6kvu+dfsPFO+U8V5fyLBZopGWqZqPcRacUlxsS6cdZoR+qmuSQpvB6A=
    =uhQB
    -----END PGP SIGNATURE-----