XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
- XSLT Help and Discussion (7625)
-> + Limitation to variable value i... (3)
-> + Using xsl to transfer XML data... (2)
-> + Moving data from one xml file ... (3)
-> + Key() returning empty node (2)
-> + Query in Xpath (2)
-> + Curly braces to substitute val... (4)
-> + Not grouping all nodes (3)
-> + Simplifying this long if state... (6)
-> - "Select" - help (4)
-> ->No Topic
-> ->No Topic
-> ->No Topic
-> + xsl:result-document and Xalan (3)
-> + Native Java types and extensio... (3)
-> - Deleate element except one of ... (1)
-> + text() function and xalan - lo... (3)
-> + Testing an Elements child Tag ... (2)
-> + transfer xml into xslt (3)
-> + Help! Transform flat XML recor... (5)
-> + Dynamic Transformations (4)
-> + Converting XML to HTML (2)
-> + Need Help --- A Special Sum Qu... (11)
-> + XML to XML transformation (3)
-- Previous [1441-1460] [1461-1480] [1481-1500] Next
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Topic  
Postnext
Richard PottsSubject: "Select" - help
Author: Richard Potts
Date: 19 May 2006 08:26 AM
Got a question why my select doesn't match one way but works another:


<xsl:value-of select="//PID[@id = ../@id and @service = ../@service and @type = ./PIDElementDataType]/PIDResolution"></xsl:value-of>

The above xsl doesn't match (and so doesn't output a value)
However if I define all the 'values' as variables and use these in the select statement I do get a match:

<!-- Value 1 -->
<xsl:variable name="pidDataType">
<xsl:value-of select="./PIDElementDataType"></xsl:value-of>
</xsl:variable>
<!-- Value 2 -->
<xsl:variable name="pidID">
<xsl:value-of select="../@id"></xsl:value-of>
</xsl:variable>
<!-- value 3 -->
<xsl:variable name="pidService">
<xsl:value-of select="../@service"></xsl:value-of>
</xsl:variable>

<xsl:value-of select="//PID[@id = $pidID and @service = $pidService and @type = $pidDataType ]/PIDResolution"></xsl:value-of>

To me, with the substitution, the two statements are identical... I must be missing something fundamental to xsl? Any ideas?

If I could write my code similar to the first statement my code would be a lot shorter.

Thanks in advance.

Postnext
Ivan PedruzziSubject: No Topic
Author: Ivan Pedruzzi
Date: 19 May 2006 09:33 AM
Hi Richard,

Which XSLT processor are you using?

Could you post a sample of your data?


Ivan Pedruzzi
Stylus Studio Team

Postnext
Richard PottsSubject: No Topic
Author: Richard Potts
Date: 22 May 2006 05:30 AM
Hi there,

I'm using the SS Enterprise "Built in" processor.

Example data attached.

Thanks.


Unknown_Normalised_Generic_example.xml
Example PID data

Posttop
Ivan PedruzziSubject: No Topic
Author: Ivan Pedruzzi
Date: 22 May 2006 11:12 AM
Hi Richard,

The expression return nothing. If you break it down it says

for any PID elements in the document
-- select those where
------ the attribute "pid" is equal to the attribute "pid" of its parent element
------- and the attribute "service" is equal the attribute service of its parent
------- ...

In the document posted there is no PID element that has parent element
with the attributes id and service.

If you explain what you are trying to select, we may be able to help.


Ivan Pedruzzi
Stylus Studio Team

   
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! 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

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
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.