Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 30th, 2015, 02:08 PM
Authorized User
 
Join Date: Feb 2013
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default Making XSLT-Parser be confused

Hallo everyone,

I hope, I am correct with my interpretation:

HTML Code:
<xsl:with-param name="myVar" select="not(./RatnasTag/Gender/text() = 'boy')" />
The input xml looks like this:
HTML Code:
...
<RatnasTag>
    <Gender>girl</Gender>
</RatnasTag>
<OtherTag>
     <OtherChildTag>value</OtherChildTag>
</OtherTag>
<RatnasTag>
    <Gender>boy</Gender>
</RatnasTag>
I was expection $myVar to be "false". But this is not the case. Instead, the value of $myVar is just null-String. I think, the parser ist confused, because:
1. On one side, it is true, that there is no "boy" in RatnasTag
2. On the other side, it is false that there is really no "boy" in RatnasTag

How can I code, so that it will become:
Set $value to be "false" if there is no "boy" in the whole xml.

Thank you for your help.

Regards,

Ratna
Germany
 
Old April 30th, 2015, 04:53 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Your condition will be true if there is no RatnasTag child of the context element whose value is equal to "boy".

The value of your variable $myVar cannot possibly be a "null string". It is a boolean, its only possible values are true and false.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
I'm confused now! chinaNoob BOOK: Beginning Visual C# 2012 0 July 7th, 2014 01:57 AM
XSLT decision Making javaguy1007 XSLT 1 April 7th, 2009 06:28 AM
confused mohabedalgani VB.NET 2002/2003 Basics 3 March 30th, 2005 11:48 PM
I'm Confused. Help!!! dangel75 General .NET 1 July 10th, 2004 09:54 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.