|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Trouble with namespaces and running identity trans
On Wednesday 10 March 2004 22:22, James J. Ramsey wrote:
>
> except in the output, that prefixes elements with
> "h:", which I do *not* want.
>
Sorry, I misunderstood the request. Not just into the XHTML
namespace but empty prefix as well. This works for me on
Sablotron and Saxon but see the note below on your question.
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml">
<xsl:template match="*">
<xsl:choose>
<xsl:when test="namespace-uri()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:when>
<xsl:otherwise>
<xsl:element name="{local-name()}">
<xsl:apply-templates select="@*|node()" />
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
> Anyway, what I'm not sure of is whether the XSLT spec
> guarantees that
>
> <xsl:element name="NCName"> <!-- No prefix in NCName
> -->
> <!-- Content of NCName . . . -->
> </xsl:element>
>
> will result in an element with the unprefixed name
> NCName in the default namespace, or if it's just that
> XSLT processors happen to serialize that as "<NCName>
> . . . </NCName>".
>
In short, I don't think there are any guarantees about this
particularly across different processors, although a general
goal of some processor writers will have been to make the output
as 'nice' as possible, i.e. minimise namespace declarations and
try and preserve prefixes.
Kev.
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








