xsl-list
[Top] [All Lists]

RE: Re: [xsl] listing elements & sub-elements in a seqence - skiping elemts if sub-elemts are present

2006-07-24 07:44:17
I, too had trouble understanding the requirement, but what caught my attention 
was the use of xsl:for-each. It looks (at first glance) like another mis-use of 
xsl:for-each where the correct approach would be to define two templates:

<xsl:template match="section[not(subsection)]">
 ...
</xsl:template>

and 

<xsl:template match="section[subsection]">
 ...
</xsl:template>

Then simply apply-templates.

-- 
Charles Knell
cknell(_at_)onebox(_dot_)com - email



-----Original Message-----
From:     David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk>
Sent:     Mon, 24 Jul 2006 15:33:05 +0100
To:       xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject:  Re: [xsl] listing elements & sub-elements in a seqence - skiping 
elemts if sub-elemts are present


  1) Whether the above code is correct or not, pls can forward me the
  syntax code equivalent to <for-each - //section[with no subsection] |
  //section/subsection..>

I didn't follow the rest of your problem statement, but if you put in
the obvious missing syntax bits like ="..." then essentially what you
write is legal Xpath to select the elements that you want.


<xsl:for-each select="//section[not(subsection]|//section/subsection"

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




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