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
Mike SappSubject: xsl:choose question
Author: Mike Sapp
Date: 07 Jul 2007 01:53 AM
Hi there, i have a question regarding xsl:choose. Ive never used this function before and would like to have a simple output of either Yes or No if the Publishers/NamePublisher node has any text in it. I belive that i have to do (*) but its not giving me the results im looking for.

Also, i would like to do a Yes/No if the element Publishers/NamePublisher is present...

<xsl:attribute name="copyright">
<xsl:choose>
<xsl:when test="Publishers/NamePublisher = (*)">
<xsl:value-of select="'Yes'"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'No'"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>

Thank you for your help in advance. Im positive this is a simple question and looking forward to your reply

Postnext
anitha peerisSubject: Re: xsl:choose question
Author: anitha peeris
Date: 07 Jul 2007 04:50 AM
Originally Posted: 07 Jul 2007 04:47 AM
Just try this, this should work. I tried and it is working.

<xsl:attribute name="copyright">
<xsl:choose>
<xsl:when test="Publishers/NamePublisher != ''' ">
<xsl:value-of select="'Yes'"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'No'"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>

-Anitha

On 7/7/07, stylus-studio-xslt Listmanager <
stylus-studio-xslt.listmanager@stylusstudio.com> wrote:
>
> From: Mike Sapp
>
> Hi there, i have a question regarding xsl:choose. Ive never used this
> function before and would like to have a simple output of either Yes or No
> if the Publishers/NamePublisher node has any text in it. I belive that i
> have to do (*) but its not giving me the results im looking for.
>
> Also, i would like to do a Yes/No if the element Publishers/NamePublisher
> is present...
>
> <xsl:attribute name="copyright">
> <xsl:choose>
> <xsl:when test="Publishers/NamePublisher = (*)">
> <xsl:value-of select="'Yes'"/>
> </xsl:when>
> <xsl:otherwise>
> <xsl:value-of select="'No'"/>
> </xsl:otherwise>
> </xsl:choose>
> </xsl:attribute>
>
> Thank you for your help in advance. Im positive this is a simple question
> and looking forward to your reply
>
>
> --
> To reply:stylus-studio-xslt.20787@stylusstudio.com
> To start a new topic:stylus-studio-xslt@stylusstudio.com
> To login:http://www.stylusstudio.com/SSDN/
> To (un)subscribe:stylus-studio-xslt.list-request@stylusstudio.com
>

Postnext
Mike SappSubject: Re: xsl:choose question
Author: Mike Sapp
Date: 07 Jul 2007 01:44 PM
Can you please explain to me why a "!" at the end of the xpath would work?

Best,

Mike

Posttop
James DurningSubject: xsl:choose question
Author: James Durning
Date: 09 Jul 2007 11:20 AM
<xsl:when test="Publishers/NamePublisher = (*)">
Interpretation: Does the text value at Publishers/NamePublisher equal that of the text value at *?

This will not be true, unless you have something like:
<currentcontext>
<first>Publisher1</first>
<Publishers>
<NamePublisher>Publisher1</NamePublisher>
</Publishers>
</currentcontext>

You could also try using the text() node xpath:
<xsl:when test="Publishers/NamePublisher/text()">


<xsl:when test="Publishers/NamePublisher != ''' ">
Interpretation: does the text value at Publishers/NamePublisher not equal to empty string? != means not equals.

 
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.