xsl-list
[Top] [All Lists]

Re: creating top-level elements from within child elements

2005-02-22 05:52:42

I asked earlier in one of my earlier posts but didnt 
get any reponse on it.

I thought I'd replied...


I wanted to know if its possible to create a new element say 'A2' from 
within the <xsl:apply-template> of 'A1' such that 'A2' is the immediate 
child of element 'A' and not 'A1'.

the phrase 

<xsl:apply-template> of 'A1'

isn't defined anywhere and I could make two guess what you mean by it,
and depending which guess I make, the answer would be yes or no.


templates are not "owned" by elements in the result tree they are 
distinguished by being matched to elements in the input. They then
generate a fragment of the output.

Clearly a single template can generate A1 and A2 as siblings rather than
A2 being a child of A1. You just make them siblings rather than a child
in the output.


you say

   and not the default

  <A>
      <A1>
            <A2/>
    </A1>
  </A>


But that is not the default. the default behaviour just gives you the
character content and no elements at all in the result tree.
You only have A2 as a child of A1 as that's the way you have it in your
stylesheet 9as I said in my first reply)

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--