xsl-list
[Top] [All Lists]

Re: xpath help?

2003-07-09 10:53:55
Paul,

The following templates should work for you.

       <xsl:template match="hls">
<xsl:apply-templates select="hl[(ots/ot/@id = '2' or ots/ot/@id = '3') and cts/ct/@id = '1']"/>
         </xsl:template>

        <xsl:template match="hl">
             <xsl:for-each select="sizes/size">
             <xsl:value-of select="@id"/>
             </xsl:for-each>
         </xsl:template>

rick

At 10:15 AM 7/9/03 -0700, you wrote:
How do I get all possible sizes from the following XML
using only one xPath given the criteria of
ot[(_at_)id = 2 or @id  = 3] and ct[(_at_)id = 1]?

so, I'd want size id's = (2,4)??

thanks in advance.


<hls>
  <hl>
    <ots>
       <ot id="2"/>
       <ot id="3"/>
    </ots>
    <cts>
       <ct id="1"/>
       <ct id="5"/>
    </cts>
    <sizes>
       <size id="2"/>
       <size id="4"/>
    </sizes>
  </hl>
  <hl>
    <ots>
       <ot id="2"/>
       <ot id="4"/>
    </ots>
    <cts>
       <ct id="2"/>
       <ct id="5"/>
    </cts>
    <sizes>
       <size id="3"/>
       <size id="8"/>
    </sizes>
  </hl>
</hls>

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Rick Taylor
XML Developer
PPDM Association


XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



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