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
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
- XSLT Help and Discussion (7625)
-> + Use of before and after string (3) Sticky Topic
-> - How do I substitute element ty... (1)
-> + How does one add working days ... (4)
-> - Help, I have existing XLT and... (1)
-> + Need help on XSLT issue - (2)
-> + EDI to XML Conversion (7)
-> - XML To JSON Conversion using X... (1)
-> + Formatting Paragraphs to same ... (2)
-> - Grouping of records (1)
-> + Problems with xsd 1.1 (4)
-> + XML to HL7 mapping (3)
-> + XSLT 3 and Iterate (2)
-> + XSL-FO to PDF preview (3)
-> + java.lang.RuntimeException: Er... (2)
-> + Create Acroforms with Stylus X... (2)
-> + How to change XSLT parameter s... (3)
-> + how to change format of the da... (2)
-> + Search "Next 8 Results " doesn... (2)
-> - Support for Git (1)
-> + newbee (8)
-- [1-20] [21-40] [41-60] Next
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
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.

   
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.