Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 26th, 2006, 11:44 AM
Registered User
 
Join Date: Jul 2006
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Item Missing in Transformed Document

I am transforming an XML document to HTML. The XML document may or may not contain a certain element. If the element is present it will contain a numeric value within a range of 0 to 5.

In the HTML output I want to display a checkbox and have the checked attribute of the checkbox depend on the value contained in the XML element. Even if the element is not present in the XML document I want the checkbox to show in the HTML output. The code I wrote does not work - the checkbox does not display when the element is not present in the XML document. Below is a snippet of the code:

<td class="b33_row">NOB
      <xsl:if test="PROF=0"><input type="checkbox" id="b33_nob_cbx" checked="checked"/></xsl:if>
      <xsl:if test="PROF!=0"><input type="checkbox" id="b33_nob_cbx"/></xsl:if>
</td>

In this case PROF is the name of the XML element. Can anyone tell what I am doing wrong?

Regards,

Rich

Reply With Quote
  #2 (permalink)  
Old July 26th, 2006, 11:54 AM
mhkay's Avatar
Wrox Author
Points: 18,481, Level: 59
Points: 18,481, Level: 59 Points: 18,481, Level: 59 Points: 18,481, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,960
Thanks: 0
Thanked 292 Times in 287 Posts
Default

PROF=0 will be true if the element is present and equal to zero.

PROF!=0 will be true if the element is present and not equal to zero.

You probably want not(PROF=0) which is true if the element is not present or not equal to zero.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote
  #3 (permalink)  
Old July 27th, 2006, 12:09 AM
Registered User
 
Join Date: Jul 2006
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Mr. Kay,

Your suggestion worked. Thanks for taking the time to respond.

Regards,

Rich

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding XSLT transformed XML content dynamically jacob ASP.NET 1.x and 2.0 Application Design 2 December 1st, 2005 04:40 PM
How do I remove xmlns from transformed document? Matt Ruby XSLT 2 October 27th, 2005 08:20 AM
Add XSLT transformed XML (html) on an aspx page humour XSLT 2 September 30th, 2004 05:13 AM
Want Combo Box first item if only 1 item markw707 Access 3 June 9th, 2004 04:03 PM
Find Out First Item of each item Group Jane SQL Language 1 November 22nd, 2003 12:42 PM



All times are GMT -4. The time now is 02:38 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.