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
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext 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

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
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.