Changing fileref path in docbook files

Discussion in 'XML' started by mtp, Jul 25, 2006.

  1. mtp

    mtp Guest

    Hello,

    in several docbook XML files, i have:

    <mediaobject>
    <imageobject>
    <imagedata fileref="../images/pic1.png"/>
    </imageobject>
    </mediaobject>

    because my XSL toolchain is complicated, fop doesn't manage to find the
    png files (bad location). So i would like to preprocess the files by
    changing the URLs from "../images/" to "docbook/data/images/". The rest
    of the file must not change. Is it possible/easy to do in XSL? If yes, how?

    Thanks
    mtp, Jul 25, 2006
    #1
    1. Advertising

  2. mtp wrote:
    > Is it possible/easy to do in XSL? If yes, how?


    Start with the standard "identity transformation" stylesheet. That will
    copy the document unchanged.

    Then add a template which recognizes the once case you want to handle
    differently, and which implements that difference. For example
    (untested, and may be slight overkill):

    <xsl:template match="imagedata/@fileref[substring(.,0,3)='../']">
    <xsl:attribute name="fileref"
    select="concat('docbook/data',substring(.,3))"/>
    </xsl:template>
    Joe Kesselman, Jul 25, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Samridhi Kumar Shukla
    Replies:
    1
    Views:
    522
    Alvin Bruney
    Nov 30, 2003
  2. Karl Lang
    Replies:
    0
    Views:
    463
    Karl Lang
    Sep 24, 2004
  3. Antonio Amato
    Replies:
    2
    Views:
    1,265
    Michael Wiedmann
    Nov 18, 2004
  4. Replies:
    1
    Views:
    521
    Joseph Kesselman
    Nov 27, 2007
  5. Salman
    Replies:
    0
    Views:
    117
    Salman
    Feb 26, 2005
Loading...

Share This Page