XQuery syntax problem
Issues related to W3C XQuery.
-
- Posts: 1
- Joined: Sat Oct 28, 2017 3:43 pm
XQuery syntax problem
Hello! Im having some issues figuring out some syntax using an if-if else in an loop. What am I doing wrong? Thanks 
Best regards,
R0bin_

Code: Select all
{for $programme in $tv/programme
return
<div class="channel_programmes">
<span class="programme_time">
{data($programme/start)}
</span>
<span class="programme_title">
{data($programme/title)}
</span>
let $x := {data($programme/type)};
return
if ($x = 'movie') then
(<span class="movie">Film</span>)
else if($x = 'series') then
(<span class="series">Serie</span>)
else if($x = 'sports') then
(<span class="tvshow">Tv show</span>)
else if($x = 'tvshow') then
(<span class="sports">Sport</span>)
</div>
}
R0bin_
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: XQuery syntax problem
Hi,
What's the issue?
The snippet is out of context, so the best I can do is this:
I'm assuming $tv is declared somewhere...
PS: You seem to have switched "tvshow" with "sports", but then again I don't know what's the desired result.
Regards,
Adrian
What's the issue?
The snippet is out of context, so the best I can do is this:
Code: Select all
{
for $programme in $tv/programme
return
<div class="channel_programmes">
<span class="programme_time">
{data($programme/start)}
</span>
<span class="programme_title">
{data($programme/title)}
</span>
{
let $x := data($programme/type)
return
if ($x = 'movie') then
(<span class="movie">Film</span>)
else if($x = 'series') then
(<span class="series">Serie</span>)
else if($x = 'sports') then
(<span class="tvshow">Tv show</span>)
else if($x = 'tvshow') then
(<span class="sports">Sport</span>)
else ()
}
</div>
}
PS: You seem to have switched "tvshow" with "sports", but then again I don't know what's the desired result.
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service