At 2002-12-24 13:15 +0000, Kevin Jones wrote:
> <xsl:copy-of select="$dummy/*/namespace::*[name(.)='p']"/>
I am exploiting the fact that I know exactly what the RTF looks like
because I
created it in the variable. Therefore I know the namspace node is the only
one and its at position one of the first element. I don't think there is any
way this can be wrong in a 1.0 conforming processor. Having said that your
solution will clearly be more resiliant to anybody hacking the variable
around.
But consider that every element has an XML namespace node in order to
support the reserved xml:lang and xml:space attributes. So I think there
is guaranteed to be two nodes, and in your implementation you happen to hit
the right one.
This issue has come up in my classes. The proof I give the students is the
exposition of all namespace nodes in an XML instance using the free
developer's tool named SHOWTREE we have in our free Resource Library on our
web site:
T:\ftemp>type kevin.xml
<p:a xmlns:p="something"/>
T:\ftemp>type kevin.xml.shw
SHOWTREE Stylesheet - http://www.CraneSoftwrights.com/s/
Processor: SAXON 6.5.2 from Michael Kay
1 Element '{something}p:a':
1.I Namespace 'xml': {http://www.w3.org/XML/1998/namespace}
1.II Namespace 'p': {something}
T:\ftemp>
I have never relied on directly indexing any attached node unless I'm
looping through the entire set of nodes and using an indexing variable.
I hope this is considered helpful, Kevin, and not critical of your
assistance ... the more people who supply answers on the list, the lesser
the burden on everyone. Thanks for your time!
.................. Ken
--
Upcoming hands-on in-depth XSLT/XPath and/or XSL-FO:
- North America: Feb 3 - Feb 7,2003
G. Ken Holman mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
ISBN 0-13-065196-6 Definitive XSLT and XPath
ISBN 0-13-140374-5 Definitive XSL-FO
ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath
ISBN 1-894049-10-1 Practical Formatting Using XSL-FO
Next conference training: 2003-03-03,06
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list