|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: How is this part of the XSLT specification to be interpr
Building on David Carlisles stylesheet, to make it a *bit* more
obvious what's going on :-)
I can see the principles he's using, but I can't say that its particularly
elegant.
I think I'd rather see some java class that processed stuff in the
doc namespace. Then at least it would look better.
Regards DaveP
xml======
<?xml version='1.0'?>
<xxx xmlns="http://SourceDocument">
<b a="2">
<x:c xmlns:x="http://AnotherNamespace"/>
<c>text</c>
</b>
</xxx>
xsl=========
<?xml version='1.0'?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
extension-element-prefixes="doc"
exclude-result-prefixes="main x"
xmlns:doc="http://Documentation.com"
xmlns:main="http://SourceDocument"
xmlns:x="http://AnotherNamespace"
>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="main:xxx">
<doc:template>
<xsl:fallback><doc>
This template matches the "<xsl:value-of select="name()"/>"
element.</doc>
</xsl:fallback>
</doc:template>
<doc:select>
<xsl:fallback><doc>The next elements to be processed are
grandchildren</doc>
</xsl:fallback>
</doc:select>
<xsl:apply-templates select="*/*"/>
<doc:select>
<xsl:fallback>

The next elements to be processed are children
of the "<xsl:value-of select="name()"/>" element
</xsl:fallback>
</doc:select>
<xsl:apply-templates select="main:b"/>
</xsl:template>
<xsl:template match="x:c">
<doc:template>
<xsl:fallback>
<doc> <emph>This</emph> template matches
and copies c element nodes in the <xsl:value-of
select="namespace-uri()"/> namespace
<xsl:copy-of select="."/>
</doc>
</xsl:fallback>`
</doc:template>
</xsl:template>
<xsl:template match="main:b">
<doc:template>
<xsl:fallback><doc> The attribute value is set to: <xsl:value-of
select="@a"/></doc>
</xsl:fallback>
</doc:template>
Normal processing <xsl:value-of select="@a"/> End normal processing.
</xsl:template>
</xsl:stylesheet>
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








