[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Doctype and namespaces in source/generated files

Subject: Re: Doctype and namespaces in source/generated files
From: Mayo <mayo@xxxxxxx>
Date: Fri, 28 May 2004 15:44:16 -0700
doctype namespace
<snip />
<xsl:template match="*[not(namespace-uri())]">
than I simply xsl:copy, and apply templates. This prevents me to
specify DOCTYPE or namespaces for xhtml in the source documents, as as
soon as I specify them (in the source documents) the match rule will
stop working, and strips all my xhtml out.


So close, and yet...


Why not use:

<xsl:template match="*[namespace-uri()='http://www.w3.org/1999/xhtml']">

instead then?


because this will either strip out all html tags, or when negated, will not apply templates on my custom namespaces.


If the result document has to be in the XHTML namespace, define:

xmlns="http://www.w3.org/1999/xhtml"

on your xsl:stylesheet element.


It is xhtml at the moment (and what I want to use this for, but did not want to limit myself only to xhtml, but it will do for now).


Anyway, adding this to the xsl:stylesheet does not insert the xmlns attribute into the <html> element in output (I'm copying the <html> element, not generating it) Now that I'm thinking about it, I could match on the html element, and add/remove attributes as required.

Use the exclude-result-prefixes attribute on xsl:stylesheet to omit other
namespaces in scope for the stylesheet.



Yes, this will remove the prefixes from the elements, however it will not remove the xmlns declaration in the <html> element on top of the document (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.)


For adding the doctype, check the applicable attributes for the xsl:output
element. Use XML as output method, and add doctype-public and doctype-system
with the appropriate values.



I've found this meantime, and the doctype is added into output, thanks.



Thanks, Mayo

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.