Changing fileref path in docbook files

M

mtp

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
 
J

Joe Kesselman

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
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top