Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Is it possible to modify a source node using XSLT?

From: David Carlisle <davidc@---.--.-->
To: NULL
Date: 5/6/2005 1:46:00 AM
Barry Andrews <titanandrews@n...> writes:

> Hi,
> 
>     So the source is read only? That is good to know I suppose, although 
> it seems odd to me. Anyway,

It would be very hard to define any behaviour to an xslt transformation
if the input could change during a transformation. There is no
requirement on a processor to process any templates in any particular
order, only that the results are combined into the final result tree as
specified, so if templates could alter the input, the behaviour of every
stylesheet would be undefined, as the input to each template would
depend on implementation-specific choices of the order of template
execution.

This is the usual behaviour of any declarative/functional language.
If you evaluate a function f(x,y) a result is returned but there are no
side effects, in particular the inputs to a unction are never changed.


> let me try to explain a little more. My 
> target document might look like this:
> 
> <TARGET>
>     <FI name="Changed">
>        <CHILD_FI name="Changed_1"/>
>     </FI>
> </TARGET>
> 
> Notice that CHILD_FI name is based on FI. (with _1 appended) But I 
> cannot do this, because when I select the name from the parent, I get 
> the old name which is A. So instead my new name would end up being A_1, 
> which is not what I want.
> Make sense?
> 
In a typical transformation the names of the result elements bear no
relation at all to the names of the input elements. Think of converting
docbook to html, or html to SVG or ... When generating the name of any
element in the result you have access via xpath to any part of the
source, so any information that caused you to generate the name FI on
the parent element is available still so there is nothing to stop you
generating an element name that contains the string _FI. However you
haven't given any indication of the transformation that you are trying
to so I can't offer any code.

David



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent