Thanks for your helpful response Pavel.
Pavel Lepin wrote:
Quote:
Hemal Pandya wrote: Quote:
Is it possible to write an xsl that changes some
attributes when applied to an xml document, while
preserving rest of it.
| >
There's a very basic (and absolutely essential) technique
called 'identity transformation'.
|
I googled for 'xsl identity transformation' and came across
http://www.dpawson.co.uk/xsl/sect2/i....html#d5687e43. After
reading that I think I understand most of what you suggest.
[....]
Quote:
I would strongly recommend reading a decent XPath/XSLT
tutorial. You'll learn everything about stuff like this,
and more.
|
The reason I am interested in this is to change one of the files in the
project that comes from version control. So far I have been changing it
by hand but realized I can perhaps use xsl. I know I aught to read up
but I was hoping the problem is simple enough that I can use some magic
words.
Unfortunately, I realized too late that the example I gave is not quite
similar to the document I am working with. The document I am working
with has the following structure:
<group name="user">
<property name="password" value="none"/>
</group>
Now, I need to modify the value attribute or all property elements
contained in group user that have name=password. I could go as far as
the following for my exclusion template:
<xsl:template match="//group[@name='user']/property[@name='password']">
But I am not able to figure out what goes inside. I am thinking
whatever I put inside will replace the entire property element; what I
need is preserve all of the element except for the value attribute. I
can imagine that it will again be the same principle of identity
conversion with exclusion but can't quite figure it out with my
seat-of-pants approach.
Can you please explain how I would do that?
Thanks,
- hemal