[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: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx>
Date: Sat, 29 May 2004 00:20:19 +0200
custom doctypes
> -----Original Message-----
> From: Mayo [mailto:mayo@xxxxxxx]
>

Hi,

> The xslt I'm using matches elements in undefined namespaces, and copies
> those into the output, and processes the elements in my custom
> namespaces.
<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?

> My quesiton is, is there a better way to do this, or is there any easy
> way that I can manipulate what namespaces/doctypes the output files
> will have? (I want to strip out my custom namespaces, preserve any
> other ones, add the xhtml one, as well as add a doctype to the
> generated document).
>

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

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

on your xsl:stylesheet element.

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

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.

The relevant specifications:

For XSLT 1.0:
http://www.w3.org/TR/xslt#stylesheet-element
http://www.w3.org/TR/xslt#output

For XSLT 2.0:
http://www.w3.org/TR/xslt20/#stylesheet-element
http://www.w3.org/TR/xslt20/#element-output



Hope this helps!

Greetz,

Andreas

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.