This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
Re: XSL: Docbook to foreign DTD
/ Jochen Hein <jochen@jochen.org> was heard to say:
|>>>>> "Bob" == Bob Stayton <bobs@caldera.com> writes:
|
| [Using Namespace in XSL to generate XSL from Docbook]
|
| Bob> You need to make a couple of changes to get the namespace into
| Bob> the attribute name. First, you need to declare the namespace
| Bob> and prefix in your stylesheet:
|
| Bob> <xsl:stylesheet
| Bok> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
| Bob> xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0">
|
| That leaves me with the top level element
| <book xmlns:xlink="http://www.w3.org/1999/xlink">, where the
| xmlns:xlink attribute is not declared in the DTD. What I do have in
| the DTD is:
If you want to limit the namespace declarations in the output, put the xmlns:
on the xsl:template that processes xrefs, not at the top level:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
...
<xsl:template match="xref" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0">
match on xlink:type etc, whatever you want
</xsl:template>
...
</xsl:stylesheet>
That usually limits the placement of namespace decls in the output to
appropriate places.
Note, however, that the XSLT Rec requires only that processors output
sufficient namespace declarations to form a legal XML+Namespaces
document.
The fact that namespaces and DTDs don't play well together is just an
unfortunate fact.
Be seeing you,
norm
--
Norman Walsh <ndw@nwalsh.com> | Where it is permissible both to
http://www.oasis-open.org/docbook/ | die and not to die, it is an abuse
Chair, DocBook Technical Committee | of valour to die.--Mencius