Sign Up
Search
Options
search
Chat
Help
News
Log in
Not Logged in
Home
»
Boards
»
Stylus Studio Developer Network
»
XSLT Help and Discussion
»
FOR EACH
Topic
Topic Page
1
2
3
4
5
6
7
8
9
Prev Topic
Next Topic
next
Subject:
FOR EACH
Author:
victor pascow
Date:
07 Mar 2007 11:41 AM
Trying to establish a for-each statement. For example:
<element>
<url>xxx.com</url
<title>xxx</title>
<category>
<thiscategory>one/two/three/four</thiscategory>
</category>
</element>
<element>
<url>xxx.com</url
<title>xxx</title>
<category>
<thiscategory>a/b/c/d</thiscategory>
</category>
</element>
My for-each statement is not working, however.
<xsl:template match="element">
<xsl:for-each select="category/[thiscategory='a/b/c/d']">
I think the slashes are of issue.
I'm getting:
A location step was expected following the '/' or '//' token. [109] null
Any help?
next
Subject:
Re: FOR EACH
Author:
(Deleted User)
Date:
07 Mar 2007 11:51 AM
Hi Victor,
the correct XPath is "category[thiscategory='a/b/c/d']" (no / before the [)
Alberto
next
Subject:
Re: FOR EACH
Author:
victor pascow
Date:
07 Mar 2007 12:24 PM
Great! I love those little mistakes.
However, still running into an issue:
My display will now not yield anything.
<xsl:template match="element">
<xsl:for-each select="category[thiscategory='a/b/c/d']">
<xsl:value-of select="URL"/>
</xsl:for-each>
</xsl:template>
Thanks again.
top
Subject:
Re: FOR EACH
Author:
(Deleted User)
Date:
07 Mar 2007 12:37 PM
Victor,
once you iterate over all those "category" objects, there is no "URL"
child to select.
If you want to get to the "url" sibling element, you need to write "../url".
Alberto
Topic Page
1
2
3
4
5
6
7
8
9
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.