Sign Up
Search
Options
search
Chat
Help
News
Log in
Not Logged in
Home
»
Boards
»
Stylus Studio Developer Network
»
XQuery Help and Discussion
»
Confused using match
Topic
Prev Topic
Next Topic
next
Subject:
Confused using match
Author:
(Deleted User)
Date:
25 Jul 2006 01:48 PM
Hi,
Can you please tell me what the match does "SALES//*" ? When i change it,the output varies and i am not ables to catch what is happenning.
MY XML TREE
----------
<?xml version="1.0"?>
<SALES>
<SALE>
<REGION>Americas</REGION>
<SOFTWARE>1200</SOFTWARE>
<HARDWARE>850</HARDWARE>
<SERVICES>2000</SERVICES>
<EXTENDED_PRICE>150000.56</EXTENDED_PRICE>
<NET_PRICE>0</NET_PRICE>
<BILLING_CURRENCY>USD</BILLING_CURRENCY>
</SALE>
<SALE>
<REGION>EMEA</REGION>
<SOFTWARE>1000</SOFTWARE>
<HARDWARE>800</HARDWARE>
<SERVICES>1100</SERVICES>
<EXTENDED_PRICE>123456</EXTENDED_PRICE>
<NET_PRICE>123456</NET_PRICE>
<BILLING_CURRENCY>USD</BILLING_CURRENCY>
</SALE>
<SALE>
<REGION>APAC</REGION>
<SOFTWARE>900</SOFTWARE>
<HARDWARE>1200</HARDWARE>
<SERVICES>1500</SERVICES>
<EXTENDED_PRICE>689726</EXTENDED_PRICE>
<NET_PRICE>123456</NET_PRICE>
<BILLING_CURRENCY>USD</BILLING_CURRENCY>
</SALE>
</SALES>
Case 1
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
<xsl:template match="SALES//*">
<xsl:for-each select="ancestor-or-self::*/SALE">
<xsl:value-of select="ancestor-or-self::*/EXTENDED_PRICE"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
My output is
150000.56123456689726
150000.56123456689726
150000.56123456689726
Case 2 I changed the match to SALE//* it gives me
150000.56123456689726
150000.56123456689726
150000.56123456689726
150000.56123456689726
150000.56123456689726
150000.56123456689726
150000.56123456689726
150000.56123456689726
150000.56123456689726
150000.56123456689726
150000.56123456689726
150000.56123456689726
150000.56123456689726
150000.56123456689726
150000.56123456689726
150000.56123456689726
150000.56123456689726
150000.56123456689726
150000.56123456689726
150000.56123456689726
150000.56123456689726
But my required output is EXTENDED_PRICE of each SALE node..
Please explain me the funda in match and select..I am totally confused..
Thanks,
Dwarak
top
Subject:
Confused using match
Author:
Ivan Pedruzzi
Date:
25 Jul 2006 07:22 PM
Dwarak
We can't possible tech you a language like XSLT in the scope of message.
Please search "XSLT XPath tutorial" on google.
If you need to simply display all extened prices do the following
<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
<xsl:template match="text()"/>
<xsl:template match="EXTENDED_PRICE">
<xsl:value-of select="concat(. , ' ')"/>
</xsl:template>
</xsl:stylesheet>
Hope this helps
Ivan Pedruzzi
Stylus Studio Team
Prev Topic
Next Topic
Powered by
Stylus Studio
, the world's leading
XML IDE
for
XML
,
XSLT
,
XQuery
,
XML Schema
,
DTD
,
XPath
,
WSDL
,
XHTML
,
SQL/XML
, and
XML Mapping
!
Go to Conference:
Select Conference
Stylus Studio Feature Requests
Stylus Studio Technical Forum
Website Feedback
XSLT Help and Discussion
XQuery Help and Discussion
Stylus Studio FAQs
Stylus Studio Code Samples & Utilities
Stylus Studio Announcements
go
Log In Options
Username:
Password:
Site Map
|
Privacy Policy
|
Terms of Use
|
Trademarks
Stylus Scoop XML Newsletter:
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.