xsl-list
[Top] [All Lists]

[xsl] Re: how to select elements based on optional container argument

2007-08-22 10:30:28
I'm only subscribed to the digest, so I'm responding to my own message and hope 
it will end in the same thread.

Nick, David:

Thanks.  From both your responses I was able to trace back my troubles to the 
use of '//container'.

I'm still somewhat unclear on why and would like to understand it better - so 
if anyone has a good explanation why

<xsl:for-each select="lc:container/lc:item[not(../@select) or 
number(../@select) &gt;= position()]">
 
works, but 

<xsl:for-each select="//lc:container/lc:item[not(../@select) or 
number(../@select) &gt;= position()]">

does not (i.e., empty set), I would appreciate to hear about it.

I've used expressions starting with // before, but maybe only in 
xsl:apply-templates.  I'll investigate a bit further and if I find anything 
interesting I will share.

Thanks again for your time.

Andreas

----- Original Message ----
From: Andreas Kemkes <a5sk4s(_at_)yahoo(_dot_)com>
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Sent: Tuesday, August 21, 2007 3:02:37 PM
Subject: how to select elements based on optional container argument

XSLT 1.0 is a constraint.

I'm having trouble with a select expression to select the marked elements 
(<!--X-->) in the following XML:

<container select="2">
  <item>...</item><!--X-->
  <item>...</item><!--X-->

  <item>...</item>

</container>
<container>

  <item>...</item><!--X-->

  <item>...</item><!--X-->


  <item>...</item><!--X-->


</container>

<container select="1">

  <item>...</item><!--X-->
  <item>...</item>

  <item>...</item>

  <item>...</item>

</container>

In the case of a no select attribute all items in the container should be in 
the node set.
If there is a attribute select="n", only the first "n" items should be in the 
node set.
The expression needs to work across all containers.

There is the additional constraint that only items with parent container are to 
be selected.


Where could I start to look for code examples that solves a similar problem?

Thanks in advance for your help.




      ________________________________________________________________
! in your own image.  Join our Network Research Panel today!   
http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 







      
____________________________________________________________________________________
Fussy? Opinionated? Impossible to please? Perfect.  Join Yahoo!'s user panel 
and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 


--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>