At 2008-03-21 21:17 +0000, Aaron Gray wrote:
I have the following but cannot seem to get it to match head or body :-
In XSLT 1.0 unprefixed element names are *always* in no namespace,
they are never in the default namespace.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns="http://www.w3.org/1999/xhtml"
>
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html>
<xsl:apply-templates select="." mode="html"/>
</html>
</xsl:template>
<xsl:template match="head" mode="html">
head
<xsl:copy-of select="*"/>
</xsl:template>
<xsl:template match="body" mode="html">
body
<xsl:copy-of select="*"/>
</xsl:template>
</xsl:stylesheet>
Try adding a prefix to every element name used in an XPath expression:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns="h:http://www.w3.org/1999/xhtml"
>
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html>
<xsl:apply-templates select="." mode="html"/>
</html>
</xsl:template>
<xsl:template match="h:head" mode="html">
head
<xsl:copy-of select="*"/>
</xsl:template>
<xsl:template match="h:body" mode="html">
body
<xsl:copy-of select="*"/>
</xsl:template>
</xsl:stylesheet>
I hope this helps.
. . . . . . . . . . . . . Ken
--
Upcoming: UBL Apr.22,24; genericode code lists Apr.23; Rome,Italy
World-wide corporate, govt. & user group XML, XSL and UBL training
RSS feeds: publicly-available developer resources and training
G. Ken Holman mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--