Filtering the output using select attribute from XML file in XSLT

  • Thread starter itssri.srinivas
  • Start date
I

itssri.srinivas

Hi,

Below is the XSL syntax to filter output from XML file based on single
value:-

<xsl:for-each select="catalog/cd[artist='Bob']">

so, above code displays the text of the CD elements whose artist is
'Bob'.

But, whats the correct syntax to displays CD elements whose
artist='Bob' And 'Alice' And 'Tom'.

is it:-
1. <xsl:for-each select="catalog/cd[artist='Bob'] And
[artist='Alice']">

Or
2. <xsl:for-each select="catalog/cd[artist='Bob'] &&
[artist='Alice']">
OR
3. <xsl:for-each select="catalog/cd[artist='Bob' && 'Alice']">

anything else. Please guide me

Thanks,
 
J

Joseph Kesselman

But, whats the correct syntax to displays CD elements whose
artist='Bob' And 'Alice' And 'Tom'.

First hint: That isn't going to be an "and" operation. The artist can
never be all three values at once. You probably want the elements whose
artist attribute is Bob OR Alice OR Tom.

I suspect that'll be enough for you to solve it by yourself; if you're
still hung up after trying it, let us know.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top