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

Re: Adding or modifying by path

Subject: Re: Adding or modifying by path
From: Hans Gerwitz <xml@xxxxxxxxxx>
Date: Wed, 18 Oct 2000 23:53:15 -0500
gerwitz
> I hope I'm not the only one here who has absolutely no idea what
> non-trivial thing you are trying to do. :) What is the input, what is
> the output, what do you mean by /a/b/c and how does that relate to the
> input and output? Where are the 'duplicates' you speak of?

Sorry, in my effort to be concise I apparently went overboard :-)

Input I:
 <a><b><c>42</c></b></a>

Input II:
 <a></a>

Output (from either input):
 <a><b><c>foo</c></b></a>

The "duplicates" I spoke of would be elements, or perhaps more correctly
put, branches of the result tree.

The example above would be accomplished by an XSLT implementing "add a tag
/a/b/c with value 'foo'"  "a/b/c" then is just my XPathish shorthand for an
element and its context.  This shorthand is necessary, as the implementation
will itself be the result of applying a transform to an XML doc that
"defines" a modification such as this.

It is trivial to modify (via a template match) ala Input I or to add a new
element (via xsl:copy and xsl:element) as in Input II.

No amount of contortion, though, has led to a solution that works for both
of the inputs above.  I either fail to create the needed new elements to
input II above, or end up "duplicating" a branch in Input I (e.g. returning
<a> <b><c>42</c></b> <b><c>foo</c></b> </a>)

My attempts thus far have been able to satisfy simple examples (including
this one) but then fail in further testing (e.g. when trying to implement
"add a tag a/b")  I haven't provided sample code because I'm afraid I'd only
further cloud the issue.  Please let me know if anyone would rather debug
:-)

Thanks,
Hans Gerwitz
hans @ phobia . com


 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.