XSL concise tutorial (6) XSL filtering and query

Source: Internet
Author: User

Original: Jan Egil refsnes

Vi. XSL filtering and query

What should we do if we want to display only XML data that meets certain conditions? Or the above exampleCodeYou only need to add parameters to the select attribute of the XSL: For-each element. For example:

<XSL: For-each select = "catalog/CD [artist = 'Bob dylan']">

The logical options of parameters include:

= (Equal)

=! (Not equal)

& Lt & less

& Gt & greater than or equal

The same as the previous example (cd_catalog_sort.xsl ):

<? XML version = '1. 0'?>

<XSL: stylesheet xmlns: XSL = "http://www.w3.org/TR/WD-xsl">

<XSL: template match = "/">

<HTML>

<Body>

<Table border = "2" bgcolor = "yellow">

<Tr>

<TH> title </Th>

<TH> artist </Th>

</Tr>

<XSL: For-each select = "catalog/CD [artist = 'Bob dylan']">

<Tr>

<TD> <XSL: value-of select = "title"/> </TD>

<TD> <XSL: value-of select = "artist"/> </TD>

</Tr>

</XSL: For-each>

</Table>

</Body>

</Html>

</XSL: Template>

</XSL: stylesheet>

You can test the results by yourself.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.