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
Conferences
Stylus Studio Feature Requests
(1192)
Stylus Studio Technical Forum
(14621)
Website Feedback
(249)
XSLT Help and Discussion
(7625)
XQuery Help and Discussion
(2017)
Issue with Processing Instruct...
(2)
problem converting json to XML...
(2)
Problem base64 decoding string...
(3)
Problems posting multipart for...
(5)
trouble with download of price...
(2)
Problem with http-post not bei...
(3)
path problem, xps_file:writeAl...
(9)
Xquery update support?
(2)
problem with Stylus studio try...
(5)
adding dtd reference to xml ou...
(4)
xquery escaping ambarsand when...
(3)
Whitespace problem when return...
(5)
Problem with namespace prefix ...
(5)
Sending via SFTP returns unexp...
(1)
Query and Sftp clent
(4)
xquery and try - catch
(3)
Query + ddtek:http-post optio...
(5)
Example files referenced in do...
(3)
Automatic Error Detection and ...
(3)
Working with result of ddtek:h...
(2)
[1-20]
[21-40]
[41-60]
Next
Stylus Studio FAQs
(159)
Stylus Studio Code Samples & Utilities
(364)
Stylus Studio Announcements
(113)
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
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.