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

XML criterias

Subject: XML criterias
From: "Chen, Gin" <Gin_Chen@xxxxxxxxxxxxx>
Date: Tue, 2 Jul 2002 15:29:21 -0400
criterias
Hi all,
	I have an XML document that I need to parse out certain information.
The information that I'm looking for is in a separate XML generated with my
XSL.
So an example would be (simplified):
//in my xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="C:\NAlert\test.xsl"?>
<datarows>
	<rowset id="100" value="100" blah="A"/>
	<rowset id="200" value="200" blah="B"/>
	<rowset id="300" value="100" blah="C"/>
</datarows>

//inside my xsl

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:fo="http://www.w3.org/1999/XSL/Format"
	xmlns:c="http://tempuri/criteria">

<xsl:output method="html"/>

<xsl:variable name="para" select="document('')/*/c:criteria/c:parameter"/>

<xsl:template match="//datarows/rowset">
	<xsl:copy-of select="@*[name()=$para/@name and
.=$para/c:value]/parent::*"/>
</xsl:template>

<c:criteria>
	<c:parameter name="id">
		<c:value>100</c:value>
		<c:value>200</c:value>
	</c:parameter>
	<c:parameter name="value">
		<c:value>100</c:value>
	</c:parameter>
</c:criteria>

</xsl:stylesheet>

so i'm basically saying that i want to get all datarows/rowsets that have
ids of either 100 or 200 AND value of 100
the problem is that I'm getting back all rows because its returning true if
any parameter name/value matches.
I dont want to hardcode all the parameter names in to the select because
there could be alot of attributes to check.
Is there a better way to do this but still keeping it generic?
Thanks,
-Tim

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


Current Thread
  • XML criterias
    • Chen, Gin - Tue, 2 Jul 2002 15:32:50 -0400 (EDT) <=
      • <Possible follow-ups>
      • Chen, Gin - Wed, 3 Jul 2002 14:11:03 -0400 (EDT)

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.