[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: David Carlisle <davidc@xxxxxxxxx>
Date: Sat, 12 Jul 2003 23:00:06 +0100
xslt output same as input
> So, if I am going to create a valid XML document from this,
> I need to open an element in 
> one template but close it in another template describing the other child 
> element.

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.

> xsl:copy would not put the namespace definition for one of my
> attributes.  
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.


> Specifically, one of the child elements of the root node of the original XML 
> document would have attributes from another namespace than the one that the 
> element is defined under. 

I suspect your terminology here is non standard. a well formed document
can only have one child element of the root node.

>  xsl:copy does not provide a definition of the 
> namespace of the attributes which belong to other namespaces.  Specifically, 
> the namespaces of the attributes were defined in the root element.  I 
> suspect that is why xsl:copy fails to make a valid document in this case, 
> since a straight copy doesn't include a definition of something defined 
> outside the stylesheet.  But I am not sure.  As I said, I did not try 
> xsl:copy-of.

Sorry I can't guess what you mean here.

> http://hnpux3.physics.fsu.edu/~hone/hnpuxpadmin_2003-07-12_10-17-11.959.xml
That's a required result, if you also showed your input documents, I'm
sure someone would suggest a way of doing it in xslt.

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.

David

 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.