Changing fileref path in docbook files

mtp

Usenet Archive
Joined
Mar 27, 2006
Messages
18
Reaction score
0
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
 

Joe Kesselman

Usenet Archive
Joined
Feb 3, 2006
Messages
1,229
Reaction score
0
mtp said:
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>
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,049
Messages
3,104,245
Members
248,133
Latest member
DujonT

Latest Threads

Top