This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
[docbook-apps] Re: Handling documents with Namespaces
- From: Jens Stavnstrup <js at ddre dot dk>
- To: docbook-apps at lists dot oasis-open dot org
- Date: Thu, 25 Sep 2003 09:00:27 +0200 (CEST)
- Subject: [docbook-apps] Re: Handling documents with Namespaces
- Reply-to: Jens Stavnstrup <js at ddre dot dk>
I forgot the examples, here they are
On Thu, 25 Sep 2003, Jens Stavnstrup wrote:
All,
I have defined an extension to docbook representing a special purpose
database, which I merge with a normal docbook document. As long as my
element was different from the DocBook elements, I had no problems, but
with the upcoming DTD v. 4.3, I have identifed elements introduced in 4.3,
so now I am considering using namespace, but how,
AI have experimented quite a bit, but havn't yet figured out so here is a
simple example. in the form of a XHTML document and and XST stylesheet.
The result is an exact copy of the input document?
Apparently the template for P is considered belonging to a different
namespace than all the elements in the document.
It will work if I e.g. define a prefix for the xhtml namespace, and add
this prefix on each template
<xsl:template match="xhtml:p">
...
There got to be a better way ?
--------------------------
demo.xml
--------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<p>Some text</p>
</body>
</html>
--------------------------
demo.xsl
--------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml"
version='1.1'>
<xsl:template match="p">
<p><strong>
<xsl:apply-templates/>
</strong></p>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Regards,
Jens
To unsubscribe from this list, send a post to docbook-apps-unsubscribe@lists.oasis-open.org.