Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: apply-templates select and multiple filters [Thread Next] Re: apply-templates select and multiple filtersTo: NULL Date: 2/14/2009 6:44:00 PM this works for me
<xsl:template match="//div[@class='books']">
<xsl:if test="count(//div[@class='book'] [@RelationshipType='10'])>0">
<div>
Top Rated Books:<br/>
<xsl:apply-templates select="//div[@class='book']
[@RelationshipType='10']"/>
</div>
</xsl:if>
</xsl:template>
where my xml is
<div class="user" version="1.0">
<div class="username" UserName="asdfasdfaaa" >asdfasdfaaa</div>
<div class="books">
<div class="book" id="80066348-4387-9000-0000-000000000000"
KeyNameLink="9783484366008_Thone_Melodies_Arias_And_Canzonettas_On_The_Music_Of_German_Baroque_Songs_V_100"
RelationshipType="10" Rating="4">Thone Melodies, Arias, and Canzonettas: On
the Music of German Baroque Songs: v. 100</div>
<div class="book" id="79980005-1387-9000-0000-000000000000"
KeyNameLink="9783150008997_Das_Narrenschiff" RelationshipType="10"
Rating="3">Das Narrenschiff</div>
</div>
</div>
--------------------------------------------------
From: "Joe Fawcett" <joefawcett@n...>
Sent: Friday, February 13, 2009 1:11 PM
Newsgroups: microsoft.public.xsl
Subject: Re: apply-templates select and multiple filters
>
> "smnbss" <nospamsmnbss@h...> wrote in message
> news:2CC4EF84-D277-4F49-A5DE-29BB423EA0FF@m......
>> sure?
>> if I use the "and" it does not work
>>
>> I managed to get it working with the space rather than "and"
>>
>> "//div[@class='book'] [@RelationshipType='10']"
>>
>> "Alex Yackimoff" <yackimoff@N...> wrote in message
>> news:uz5PQbajJHA.3656@T......
>>> "smnbss" <smnbss@h...> wrote in message
>>> news:C33B7B05-7615-4497-8A30-333D5DEDB537@m......
>>>> is it possible to create a an apply-templates that filter by class and
>>>> RelationshipType?
>>>> something like
>>>> <xsl:apply-templates select="//div[@class='book'] and
>>>> //div[@RelationshipType='10']"/>
>>>
>>> <xsl:apply-templates select="//div[@class='book' and
>>> @RelationshipType='10']"/>
>>>
>>> --
>>> Alex Yackimoff
>>>
>
> Are you sure you have the correct syntax, post exactly what you tried?
> In many cases the two forms will give the same results anyway, especially
> when filtering on attributes of the same element.
>
> --
>
> Joe Fawcett (MVP - XML)
> http://joe.fawcett.name
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
