|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Doctype and namespaces in source/generated files
However, creating the html root as a literal result element (or via I've noticed this with few other tests I did, and fised it accordingly as suggested by Ken Holman few emails back. (I'm not really concerted with removing them, as they do no harm, but it would certainly be cleaner. I'm more concerned about adding new ones in.) The was I had my stylesheet working was that I introduces namespaces that I wanted to process in the source html document (and hence could not introduce xhtml one, as it would strip all the tags out. And becaused I used to use copy, the xhtml namespace would not be introduces in the output (only my custom one was preserved - copied from the source). With rewriting the stylesheet as suggested and introducing doctype, the xhtml xmlns is now in the output document. I'm attaching my current version below, just so it's easier to understand. Anyway, thanks everyone for their help, I've got it almost all working. Thanks, Mayo Source: (not including doctype) <html xmlns="http://www.w3.org/1999/xhtml" xmlns:tpl="tpl:namespace" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /> <title>xslt test</title> </head> <body>
<p>xsl test1: <tpl:var/></p>
</body>
</html>Stylesheet:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:tpl="tpl:namespace"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="tpl"><xsl:output method="xml" indent="yes" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" omit-xml-declaration="yes"/> <xsl:strip-space elements="*"/> <xsl:template match="*[not(namespace-uri())] | xhtml:*">
<xsl:element name="{local-name(.)}">
<xsl:apply-templates/>
</xsl:element>
</xsl:template> <xsl:template match="tpl:var">
<xsl:element name="b">
<xsl:value-of select="'blarg'"/>
</xsl:element>
</xsl:template> <!-- last catchall, to be safe -->
<xsl:template match="tpl:*"/></xsl:stylesheet>
|
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








