Hi all -
Thanks, but I am not requesting help with this since it works. To further
clear things up about what I am talking about, I have written the following
based on my experience developing this with my Xalan processor.
Elements don't open and close in XSLT. They are nodes that are single
entities. opening and closing tags are a feature of the linearisation to a
file, not a feature of the trees on which XSLT works.
Your "so" doesn't follow, if I followed your premise (which I didn't
completely, a small example would have been clearer) then that sounds
normal XSLT work, but not by generating half a node in one
template and half in another.
I am not trying to generate nodes per se, only XMl which is valid at the
end, knowing that I will parse first one element and then the other. I
simply needed regular XML to be written to the output stream. Since each of
the two child elements will be parsed separately there is no way to stream
correct XML output from each of them into a file and have them both be under
one node as legal XML unless you treat the situation specially, addressed
I have no idea what you mean here. XSLT doesn't directly deal with
namespace declarations. If you create or copy a node whose name is in a
namespace to the output tree, then the XSLT system will generate enough
namespace declarations so that when the output is re-parsed the
attributes and elements will be in the right namespaces, but this is an
automatic feature of the linearisation, not something directly under the
control of the stylesheet.
Here is the situation. A sample document looks like the following found at:
The root node contains namespace declarations. However, the two child nodes
are processed separately, each by its own stylesheet, so that the root node
is not passed to the processor. The child element as a document is the only
thing that is passed. When I apply an xsl:copy rule like those suggested in
earlier emails the elements are copied but somehow the namespaces are left
out for some attributes, specifically in the case where the namespace of an
attribute is different from its element.
I suspect your terminology here is non standard. a well formed document
can only have one child element of the root node.
Correct. I am feeding two child elements of my root node separately to
separate callings of the XSL processor. This is because I need the elements
to be processed as separate documents according to each element's assigned
stylesheet located by an attribute in the element itself. Since you can't
dynamically load stylesheets based on an XPath query or the like, I in code
get the stylesheet's location from the attribute value and then parse the
element as its own separate document. However, one application I must
support requires that the two elements be linked back up under a root node
and there are complications in doing that which I had to deal with.
You say XSLT has problems outputting < which isn't the case at all.
If you output < using the xml or html output methods, then that
character will be output in a form legal in those formats (eg <)
however this stylesheet appears to be writing a perl script.
If you'd used xsl:output method="text" then when serialising to a text
stream < characters will be written out as < as you'd expect.
Yes, if the output method is xml, any element you try to create simply by
typing the characters which form a legal XML element will not be allowed to
be opened without being closed. So the following will be picked up by the
processor as illegal:
If my output method is text then this problem does not happen. However, in
text output the only thing that makes the output stream are the text nodes
of my input XML elements, so I need the output method to be xml. Otherwise
I have to write more code which serializes every element into text, and I
would like to have as much of that done for me as I can.
The new MSN 8: advanced junk mail protection and 2 months FREE*
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list