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
Michael KweeSubject: Increment a variable
Author: Michael Kwee
Date: 15 Jan 2007 02:06 AM
Originally Posted: 15 Jan 2007 02:04 AM
Hi there,

I am trying to increment a avariable and i understand that there are a couple of examples using recursive function already posted. However, these examples do not meet my requirement.

What i wanted to do is to parse a xml document and when it hits an attribute OEServiceStatus, it will perform checks on the first and second child nodes. This OEServiceStatus is recurring under a parent node FsActivityStep.

However, i was not able to increment the variable count ($dummy) even by calling a recursive function.

/*/*/*/ListOfOeProvisioningTask-Integration/OeProvisioningTask-Integration[$dummy]/ListOfFsActivityStep/FsActivityStep[1]/OEEventCode!='0'

Please see my attached code. Thanks.


Unknowntest_count.xsl


UnknownINT145_Resp.xml

Posttop
(Deleted User) Subject: Increment a variable
Author: (Deleted User)
Date: 15 Jan 2007 03:59 AM
Hi Michael,
if I have understood correctly, you are trying to use a variable to pick the right element from the source; but if the data is related to the subtree where the OEServiceStatus node resides, you can access it using a relative XPath, like in

<xsl:when test="../ListOfFsActivityStep/FsActivityStep[1]/OEEventCode!='0'">
<xsl:value-of select="'Failed'"/>
</xsl:when>
<xsl:when test="../ListOfFsActivityStep/FsActivityStep[1]/OEEventCode='0'">
<xsl:choose>
<xsl:when test="../ListOfFsActivityStep/FsActivityStep[2]/OEEventCode!='0'">
<xsl:value-of select="'Partially Successful'"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'Successful'"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>

Hope this helps,
Alberto

 
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.