Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Creating a node outside context node

From: "Kevin Spencer" <spam@---.--->
To: NULL
Date: 11/4/2006 5:09:00 PM

> What I was asking is: how can I created an element which would be placed 
> not at the current position but at some specified, previously built, node 
> of the result tree.

Unless you plan it out beforehand, you can't. OTOH, if you use XPath to 
navigate around in the original XML, you should be able to do what you want, 
by changing the order of the transformation.

-- 
HTH,

Kevin Spencer
Microsoft MVP
Ministry of Software Development
http://unclechutney.blogspot.com

I just flew in from Chicago with
a man with a wooden leg named Smith
who shot an elephant in my pajamas.
So I bit him.


"Arnost Sobota" <sabotage@m...> wrote in message 
news:454c9bbf$0$27403$ba4acef3@n......
> Thank you for your answer. I realise that my statement of the problem was 
> dramatically confused.
>
> What my XSLT code is doing is copy the input XML document to the output 
> document, with some alterations, but on the whole the structure of the 
> output file follows that of the input file.
> (Hence my faulty reference to "context nodes", input and output mishmashed 
> in my head).
>
> So the XLST script copies the nodes step by step as the input tree is 
> parsed, and sometimes has to create a new element (<xsl:element/>). When 
> this happens, the new element is placed at the point at which the result 
> tree is currently located. This is obvious.
>
> What I was asking is: how can I created an element which would be placed 
> not at the current position but at some specified, previously built, node 
> of the result tree.
> (OK, my problem is certainly ill-posed, I'll have to reconsider it with a 
> fresher mind!)
>
> Arnost
>
> Martin Honnen a écrit :
>> Arnost Sobota wrote:
>>
>>> I'm currently developing and XSLT and I'm now facing a problem that 
>>> would easily be solved *if* I could find a way to create a node) some 
>>> place else than the XML context node.
>>
>> The context node is in the input tree where you can't create any nodes at 
>> all as the XSLT stylesheet creates all new nodes in the result tree.
>>
>>> I'm inside a xsl:template, so the scope of any XSL action performed here 
>>> is the matching XML node. What I'd like is to overcome this limitation 
>>> by being able to perform an action outside this context node (in a node 
>>> that I would explicitly indicate, of course).
>>
>> It is not clear what the problem is, provide a minimal XML input, show us 
>> the relevant part of the stylesheet and we might be able to tell you 
>> more.
>> As already said, the input tree with context nodes is completely 
>> different from the result tree the XSLT stylesheet creates.
>> Then in the XSLT stylesheet you can of course call other templates with 
>> xsl:call-template, you can access any node with absolute XPath if needed, 
>> you can access any node relative to the content node.
>> 




transparent
Print
Mail
Digg
delicious
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