This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Quering attributes
- To: XSL-List at mulberrytech dot com
- Subject: Quering attributes
- From: sdemler at tacit dot co dot nz
- Date: Tue, 14 Mar 2000 16:45:36 +1300
- Reply-To: xsl-list at mulberrytech dot com
I am having difficulty with using the xsl:if statement. What I would like
to do is to query a particular attribute of a node and if it is greater
than a certain value then I would like to display the value of the
attribute.
A portion of the XML that I am working with is :
<dtqApplication>
<ROWdtqApplication lapp_id="2" lapp_sequence="1"
lapp_loan_account_id="2" lapp_description="Application 1, $10000.00"
lapp_status_code_id="114" lapp_application_fee="0" lapp_application_amount
="10000" lapp_annual_income="48000" lapp_uncommitted_income="2300"
lapp_approved="Y" lapp_editable="N" lapp_created_by="5" lapp_created_date
="19990720T16:22:02000" lapp_last_updated="19990720T17:51:02763"
lapp_last_updated_by="Steve" lapp_timestamp="4316430218" calc_status_desc
="Granted and Settled"/>
<ROWdtqApplication lapp_id="2005" lapp_sequence="2"
lapp_loan_account_id="2" lapp_description="Application 2, $7500.00"
lapp_status_code_id="105" lapp_application_fee="0" lapp_application_amount
="7500" lapp_annual_income="89000" lapp_uncommitted_income="111111"
lapp_approved="N" lapp_editable="Y" lapp_created_by="6" lapp_created_date
="19991201T14:37:56000" lapp_last_updated="19991201T14:32:11826"
lapp_last_updated_by="SteveTestUser" lapp_timestamp="4316430232"
calc_status_desc="Awaiting Descision"/>
The XSL that I believe should be outputted is :
<?xml version="1.0"?>
<xsl:stylesheet>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="dtqApplication">
<xsl:for-each select="ROWdtqApplication">
<xsl:if test="[@lapp_application_amount > '10000']">
<xsl:value-of select="@lapp_application_amount"/>
</xsl:if>
</xsl:for-each>
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
Test conditions I've tried with no results
<xsl:if test="[@lapp_application_amount > 10000]">
<xsl:if test="[number(@lapp_application_amount) > 10000]">
<xsl:if test="[number(@lapp_application_amount) > number(10000)]">
<xsl:if test="[number(@lapp_application_amount) > '10000']">
Test conditions I've tried with good results
<xsl:if test="[@lapp_application_amount = '10000']">
Does anyone have any ideas how to do this. I've spent an awful lot of time
looking through resources on the internet and trying numerous examples all
to no avail. So hopefully you guys can help me.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list