[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] Multiple OR Expression across a node-set
- From: Yves Zoundi <yveszoundi@gmail.com>
- To: xml-dev@lists.xml.org
- Date: Wed, 29 Nov 2006 19:10:25 -0500
Maybe you need to replace the or operator you are using('|') by "or".
Good luck
On
Wed, 29 Nov 2006 11:17:59 -0800 "Spencer Tickner"
<spencertickner@gmail.com> wrote:
> Hi List,
>
> Thanks in advance for the help. I think I left my brain in Cuba, and
> cannot seem to figure out this fairly straight forward problem (well
> that and secretly hoping someone has a more elegant way of doing
> this).
>
> So I have a generated XML
>
> <root>
> <view>
> <id>foo</id>
> <name>foo</name>
> </view>
> <view>
> <id>bar_archive</id>
> <name>Bar Archive</name>
> </view>
> <view>
> <id>bar</id>
> <name>bar</name>
> </view>
> <view>
> <id>foo_archive</id>
> <name>Foo Archive</name>
> </view>
> </root>
>
> Issue comes from the fact that every time I get this XML file, the
> <view>s are in different, random order. I need them in a specific
> order every time. Along with this, sometimes a <view> exists, and
> sometimes it doesn't which should be reflected in the output. So far
> my XSL looks something like this (I've marked where my if statement is
> failing):
>
> <?xml version='1.0'?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>
> <xsl:template match="/">
>
> <html>
> <body>
> <!-- This if statement fails (Value of expression cannot be converted
> to a node-set in expression) -->
> <xsl:if test="root//view/id = 'foo' | root//view/id = 'bar'">
> <p>Here are the foo bars</p>
> <ul>
> <xsl:apply-templates select="root//view[id='bar']"/>
> <xsl:apply-templates select="root//view[id='foo']"/>
> </ul>
> </xsl:if>
>
> <xsl:if test="contains(root//view/id, 'archive')">
> <p>Here are archive foo bars</p>
> <blockquote>
> <xsl:apply-templates select="root//view[id = 'bar_archive']"/>
> <xsl:apply-templates select="root//view[id = 'foo_archive']"/>
> </blockquote>
> </xsl:if>
>
> </body>
> </html>
>
> </xsl:template>
>
> <xsl:template match="view" priority="5">
> <li><xsl:value-of select="name"/></li>
> </xsl:template>
>
> <xsl:template match="view[contains(id, 'archive')]" priority="10">
> <p><xsl:value-of select="name"/></p>
> </xsl:template>
>
> </xsl:stylesheet>
>
> Any thoughts would be greatly appreciated. (PS - I am stuck with 1.0)
>
> Thanks you,
>
> Spencer Tickner
>
> _______________________________________________________________________
>
> XML-DEV is a publicly archived, unmoderated list hosted by OASIS
> to support XML implementation and development. To minimize
> spam in the archives, you must subscribe before posting.
>
> [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
> Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
> subscribe: xml-dev-subscribe@lists.xml.org
> List archive: http://lists.xml.org/archives/xml-dev/
> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
>
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]