> Hmmm. I thought I will understand it easily. But no. I don't.
>
[quoted text clipped - 21 lines]
>
> DB
> > Hmmm. I thought I will understand it easily. But no. I don't.
> >
[quoted text clipped - 48 lines]
>
> Looking for a more elegant solution ...
Basically, I am looking for a solution that lets me keep everything
else as the source
document, but allows
- adding a couple sub-elements,
- changing values of existing attributes
Thus, it's a more decorated XML than the source XML. How can I do it
better?
TechBookReport - 02 Nov 2006 18:29 GMT
>>> Hmmm. I thought I will understand it easily. But no. I don't.
>>>
[quoted text clipped - 56 lines]
> Thus, it's a more decorated XML than the source XML. How can I do it
> better?
Well I'm not sure how elegant this is, but for each element you want to
change you can do this:
<xsl:copy> //make a copy of the element
<xsl:copy-of select="@*/> //copy all of the attributes
<xsl:attribute name="change">new</xsl:attribute> //change an attribute
<xsl:attribute name="new">new</xsl:attribute> //add an attribute
<xsl:element>Add new element</xsl:element> //add an element
<xsl:apply-templates select="next"/> //move on down the tree
</xsl:copy>
Pan

Signature
TechBookReport Java http://www.techbookreport.com/JavaIndex.html
Greg R. Broderick - 02 Nov 2006 23:28 GMT
>> > Hmmm. I thought I will understand it easily. But no. I don't.
>> >
>> > I just want to make a copy of a source xml into a result xml and
>> > change the values of attributes of certain elements. How do I
>> > write the stylesheet for this seemingly straightforward
>> > transformation?
[remainder snipped]
IMHO, you're much more likely to receive a timely, correct and complete
answer if you ask your question(s) in a news group that deals with the
topic of XML / XSL, such as comp.text.xml, than you are in a news group
that deals with the topic of programming in the Java language.
Cheers
GRB
Dhurandhar - 03 Nov 2006 08:01 GMT
Thanks for the answer and a pointer to the appropriate group.
Will be watchful next time.
Thanks,
> >> > Hmmm. I thought I will understand it easily. But no. I don't.
> >> >
[quoted text clipped - 12 lines]
> Cheers
> GRB