Subject: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...
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
>
Subject: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.