RE: [xml-dev] How to get XPath in a XSLT shylesheet

From
Michael Kay <>
To
'David Carlisle' <>
Date
2007-01-09T11:44:46
ID
<00d301c733e3$8fef0eb0$6401a8c0@turtle>
Thread
RE: [xml-dev] How to get XPath in a XSLT shylesheet
> although actually along a sibling axis you have quite hard to 
> "accidentally" get multiple prefixes.

Not really. You just have to do something like this:

<xsl:template match="vc:changes"
xmlns:vc="http://acme.com/ns/version-control">
  <vc:changes>
    <xsl:copy-of select="*"/>
    <vc:change date="{current-date()}">Changed by stylesheet XYZ</vc:change>
  </vc:changes>
</xsl:template>

Existing elements will retain the prefix in the original document, the new
element will have the prefix used by the stylesheet author. Once you get two
sub-communities who prefer different prefixes (as with "xs" and "xsd")
you're going to end up with documents that mix the two.

Michael Kay
http://www.saxonica.com/