Re: [xslt] indentation problem and some related questions



> why are you using document() here? why isn't it just
>  <xsl:copy-of select="/html:html/html:body/*"/>
I'm using the standard xml input as a way to pass parameters to the
xsl stylesheet. Therefore it's occupied. Also, the name of the actual
document to be loaded is dynamic and determined at run-time.

>> Issue 2: unable to query document using element names.
> yes, because its XHTML, where the elements are in a namespace, so you need namespace prefixes on the element names in the xpath expression.
In the original document, these elements existed under a default
namespace. My stylesheet also declares this namespace and also uses it
as default. Since the namespaces match, I shouldn't need to do any
extra steps, right? But since it doesn't work, I assume that the
namespaces are actually mutually exclusive instead of matching. I
checked my earlier project where I did something similar, and saw that
it worked there just fine. The only difference that in there, the xsl
stylesheet had no default namespace defined.

>> Issue 3: namespace declarations in the xml document leak into the output.
> the serializer in XSL processors usually gets namespace decls right, honestly.
Yeah, but the xsl:copy-of operation copies over all xmlns: attributes,
even for namespaces that are never used in the final output. For
example, if I attach an xml stylesheet to the xml data file,
xsl:copy-of will introduce the xmlns:xsi namespace declaration to all
copied elements (topmost level). And having funky xmlns: attributes
all over my webpage makes it look strange :)


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