[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: RE: How to get output XML same as input XML?

Subject: RE: RE: How to get output XML same as input XML?
From: "Josh Hone" <icsad@xxxxxxxxxxx>
Date: Sat, 12 Jul 2003 21:40:52 -0400
output xml
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 below.



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:
http://www.jlab.org/~hone/gridsubDemo/demo.xml
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.




In http://www.jlab.org/~hone/gridsubDemo/StartWrap.xsl
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 &lt;)
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:


<xsl:template name="openElement">
 <myElement>
</xsl:template>

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.


Josh Hone


_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.