Re: [xslt] indentation problem and some related questions



Viktor Štujber wrote:

The setup: a small xml (xhtml) file containing some xhtml data, and a
small xsl file to display the contents of the xhtml's <body> element.
For the transformation itself, we'll be using
     <xsl:copy-of select="document('test.xml')/*[1]/*[2]/node()" />

this is technically correct, but an usual way to express it. why
are you using document() here? why isn't it just

  <xsl:copy-of select="/html:html/html:body/*"/>

?

Issue 2: unable to query document using element names.
Notice that in the xslt fragment above, I used document()/*[1]/*[2]/*
to get the desired outcome.
For some reason beyond my understanding, if I use
"document()/html/body/*", or any prefix of that, all I seem to get is
an empty node set.

yes, because its XHTML, where the elements are in a namespace, so
you need namespace prefixes on the element names in the xpath
expression.


Issue 3: namespace declarations in the xml document leak into the output.

the serializer in XSL processors usually
gets namespace decls right, honestly.

--
Sebastian Rahtz
Information Manager, Oxford University Computing Services
13 Banbury Road, Oxford OX2 6NN. Phone +44 1865 283431



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]