XPath expressions do not recognize default namespaces. In your stylesheet
add:
<xsl:stylesheet
...
xmlns:xhtml="http://www.w3.org/1999/xhtml"
...>
Then, change your select to:
<xsl:for-each select="/xhtml:html/xhtml:BODY/xhtml:H1">
-----Original Message-----
From: professorCharlie [mailto:charlie@...]
Sent: Monday, June 03, 2002 2:13 PM
To: xml-litprog-l@yahoogroups.com
Subject: [xml-litprog-l] xslt question (derived from use of xmlp)
Tony, you suggested that I could just add in my own table of content
handling. I'm new to XSL and XSLT, and I spent a huge amount of time
trying to get a very simple TOC template added to weave-xhtml.xsl.
I'm hoping you or someone reading this list can help me out.
I tried adding:
<xsl:template match="lp:table-of-contents">
testing
<xsl:for-each select="/html/BODY/H1">
<xsl:element name = "h2">
<xsl:value-of select="."/>
</xsl:element>
</xsl:for-each>
</xsl:template>
to the end of weave-xhtml.xsl (just before the close stylesheet
element).
The problem is that if the document I'm processing contains
a default namespace declaration:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:lp="http://www.xmLP.org/2001/ns/xmLP/" version="-//W3C//DTD
XHTML 1.1//EN">
then the select never matches anything. If I delete the default
namespace declaration from the document I'm processing:
<html xmlns:lp="http://www.xmLP.org/2001/ns/xmLP/"
version="-//W3C//DTD XHTML 1.1//EN">
Then the select finds the H1 tag as expected. This seems backwards.
====
Unsubscribe: xml-litprog-l-unsubscribe@yahoogroups.com
Post message: xml-litprog-l@yahoogroups.com
http://groups.yahoo.com/group/xml-litprog-l/
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/