|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: What is wrong here?
Hi Slava,
You've fallen into the namespace trap. In your source document, you've
declared a default namespace:
> <html xmlns="http://www.w3.org/1999/xhtml"
> xmlns:xlink="http://www.w3.org/1999/xlink">
> <head xmlns="http://www.w3.org/1999/xhtml">
> <title>Purveyors</title>
> </head>
> <body xmlns="http://www.w3.org/1999/xhtml">
> <div><p>Body</p></div>
> </body>
> </html>
All the elements in this document are in the XHTML namespace.
In your XSLT, when you match or select an element, you must specify
its namespace by giving it a prefix. So to match an element in the
XHTML namespace, you must declare the prefix in your stylesheet, and
use that prefix to qualify the names you use.
So your stylesheet needs to look like:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:html="http://www.w3.org/1999/xhtml"
version="1.0">
...
<xsl:template match="html:html">
<html>
<xsl:apply-templates select="html:head"/>
<xsl:apply-templates select="html:body"/>
</html>
</xsl:template>
...
</xsl:stylesheet>
Note that unless you declare the XHTML namespace as the default
namespace in the stylesheet, all the literal result elements (such as
<html>...</html> in the above) will be in *no* namespace, and not in
the XHTML namespace.
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








