|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] XML 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








