[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: InString filter in XSL

Subject: Re: InString filter in XSL
From: Eugeny Kuzakov <kev@xxxxxxxxx>
Date: Thu, 24 Jun 1999 15:50:26 +0700 (OSS)
xsl instring
On Thu, 24 Jun 1999, Christian Wittern wrote:

> <el att="aa, bb, cc">I want to select this</el>
> <el att="bb, cc">Or I want to select this</el>
> <el att="aa, cc">Or maybe I want to select this</el>
> 
> I want to select nodes based on the value of att: Either those containing
> 'aa', or 'bb', or 'cc', regardless of the other surrounding values, i.e. if
> I check for 'aa', I'd like to get the first and last, in the case of 'bb'
> the first and second, etc.
Example of xml document:

<?xml version="1.0"?>
<document>
    <el att="aa">Object with attribute aa</el>
    <el att="bb">Object with attribute bb</el>
    <el att="cc">Object with attribute bb</el>
    <el att="dd">Object with attribute bb</el>
</document>

Example of stylesheet:
<?xml version="1.0"?>
<xsl:stylesheet
    xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"
                  default-space="strip"
                  indent-result="yes"
    result-ns="">

<xsl:template match="document">
    <document>
	<xsl:apply-templates select="el[from-attributes(att) = 'aa']"/>
	<xsl:apply-templates select="el[from-attributes(att) = 'bb']"/>
	<xsl:apply-templates select="el[from-attributes(att) = 'bb']"/>
	<xsl:apply-templates select="el[from-attributes(att) = 'aa']"/>
    </document>
</xsl:template>


<xsl:template match="el">
    <selected_object>
	<xsl:value-of select="."/>
<!--	<with_attribute>
	    <xsl:value-of select="@att"/>
	</with_attribute>
-->
    </selected_object>
</xsl:template>

</xsl:stylesheet>

Example of output:

<document>
<selected_object>Object with attribute aa</selected_object>
<selected_object>Object with attribute bb</selected_object>
<selected_object>Object with attribute bb</selected_object>
<selected_object>Object with attribute aa</selected_object>
</document>

--
	Best wishes, Eugeny Kuzakov
		Laboratory 321 ( Omsk, Russia )
		kev@xxxxxxxxx
		ICQ#: 5885106

p.s. Tested with xt.


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.