--- David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk> wrote:
<xsl:variable name=set" select="Report/Rows//Row"
/>
.....
<xsl:apply-templates select="$set"/>
you've given no indication of why you need this
variable (it seems that
it isn't needed)
The reason why I created this variable is because I
need to apply templates to all the Rows in the xml.
However, the structure of the Rows in xml is a bit
peculiar. I can have 1, 2, 3 or even more RowGrp
elements before the Row elements.
Since I do not know how many RowGrp elemetns I will
have I cannot do something like this:
<xsl:apply-templates select="Report/Rows/RowGrp/Row"/>
or this
<xsl:apply-templates
select="Report/Rows/RowGrp/RowGrp/Row"/>
Therefore, I created the variable using the //
<xsl:variable name=set" select="Report/Rows//Row"/>
I also read in some posts that it is faster to use a
node set in a variable. I might be wrong though. Any
suggestion considering that I can have lots of Row and
Cell elements in the xml?
<Rows>
<RowGrp>
<RowGrp>
<Row heading="Name 1">
<Cell>
<Msr idx="1" val="10" />
<Msr idx="2" val="15" />
</Cell>
<Cell/>
</Row>
</RowGrp>
<RowGrp>
<Row heading="Name 1">
<Cell>
<Msr idx="1" val="10" />
<Msr idx="2" val="15" />
</Cell>
<Cell/>
</Row>
</RowGrp>
<RowGrp>
</Rows>
<xsl:apply-templates
select="$set[postion()]/*"/>
as I said last time, [position()] does nothing, it
is the same as
[true()] what do you intend it to do?
I have noticed that this does not work.
In the Row template I apply templates again but
this
time I use the /* to get the child elements
(Cell).
However, if I do this - <xsl:apply-templates
select="$set/*"/> - I will apply templates to all
the
Cell elements. So I will have only one <tr> with
lots
of <td>s. Something like that:
You just want to apply templates to the children of
the current node,
that's
<xsl:apply-template select="*"/>
or (more or less equivalently in this context) just
<xsl:apply-templates/>
You are right. I want to apply templates to the
children of the current Row node that is in the node
set. But if it is not possible I will have to get rid
of the node set and use only apply templates Cell.
________________________________________________________________________
The Numerical Algorithms Group Ltd is a company
registered in England
and Wales with company number 1249803. The
registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR,
United Kingdom.
This e-mail has been scanned for all viruses by
Star. The service is
powered by MessageLabs.
________________________________________________________________________
--~------------------------------------------------------------------
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>
--~--
___________________________________________________________
To help you stay safe and secure online, we've developed the all new Yahoo!
Security Centre. http://uk.security.yahoo.com
--~------------------------------------------------------------------
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>
--~--