[Home] [By Thread] [By Date] [Recent Entries]
I'm working with Saxon 6.5.3 and Xerces 2.4. My experiences suggest that
if the source document contains a default namespace then you have to map
the namespace to an alternate prefix (ddi: in my example) otherwise the
templates "match and select" statements do not work), in other words its
impossible to match elements in the default xmlns namespace without
mapping that namespace to a different prefix. I see this done often in
the FAQ, see for example:
http://www.dpawson.co.uk/xsl/sect2/N5536.html#d5145e970 I find this counter-intuitive. It seems that if the default namespace is just a namespace with the prefix "". then if I try to match elements in that namespace, then they just shouldn't have a prefix. In other words: <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
version="1.0"
xmlns="http://www.icpsr.umich.edu/DDI"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> <xsl:template match="codeBook">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<docDscr>
...
<titl>
<xsl:value-of select="stdyDscr/citation/titlStmt/titl"/>
</titl>
...
</docDscr>
<xsl:apply-templates select="*"/>
</xsl:copy>
</xsl:template>... </xsl:stylesheet> should work on the following document no matter if the xmlns is present or not: <?xml version="1.0" encoding="utf-8"?>
<codeBook xmlns="http://www.icpsr.umich.edu/DDI" >
<stdyDscr>
<citation>
<titlStmt>
<titl>foo</titl>
</titleStmt>
</citation>
</stdyDscr>
</codeBook>-Mark David Carlisle wrote: I thought to myself, there should be some way I can match the default namespace in the source document? XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|

Cart



