This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
Re: Conditional Transformation with XSL
- To: docbook-apps at lists dot oasis-open dot org
- Subject: Re: DOCBOOK-APPS: Conditional Transformation with XSL
- From: Norman Walsh <ndw at nwalsh dot com>
- Date: Tue, 07 Nov 2000 20:50:22 -0500
- References: <3A06EFF8.F345339E@pironet.com>
/ Ali Saffari <asaffari@pironet.com> was heard to say:
| We are planing to use DocBook for our userdocumentation. For this
| purpose we need to generate different kinds of documentation for online
| and print media. Several chapters, sections, imageobjects should only
| appear on online media or only on print media.
|
| We decided to use the "arch" attribute for this kind of separation.
That's fair. I probably would have chosen the less semantically
loaded "condition" myself.
[...]
| As you can see it for the para-template, I've taken the definition from
| the html-styleshhet and wrapped it with a <xsl:if ...> tag. Now I got
| two
| questions:
|
| General Question:
|
| Is this the right way for doing this kind of customization? I am not
| very
| happy about the fact that i've copied the content of the original
| template
| in my own template ad just added the <xsl:if ...>. Is there any way to
| prevent this, so don't have to check my templates every time a new
| release
| of the stylesheets are available?
Yes, use apply-imports:
<xsl:stylesheet ...>
<xsl:import href="/path/to/docbook/html/docbook.xsl"/>
<xsl:template match="para">
<xsl:if test="@arch='online' or not(@arch)">
<xsl:apply-imports/>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
You'll have to be a little carefull with para, because it appears in
several modes and with a few predicates, but that's the basic style
you're after.
| This stuff works well with tags like para, table, imageobject, admons
| and so on but if do this the same way for <chapter>, <sect1>, <sect2>
| or other section-like tags, I get corrupt output!! Some of the chunked
| files are missing!!! Does anybody knows what I am doing wrong here?
Things will (probably) work better with apply-imports, but you might
end up needing to do more work with your own custom version of the
chunking stylesheet.
| So what is the difference between these tags? How can I solve this
| problem? Please help me!
Note that chunk.xsl already overrides some of them...
Be seeing you,
norm
--
Norman Walsh <ndw@nwalsh.com> | The stone fell on the pitcher? Woe
http://www.oasis-open.org/docbook/ | to the pitcher. The pitcher fell
Chair, DocBook Technical Committee | on the stone? Woe to the
| pitcher.--Rabbinic Saying