Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| 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 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 January 24th, 2006, 02:16 AM
Registered User
 
Join Date: Jan 2006
Location: bangalore, , India.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to abhishek verma
Default basic xslt Question


hi,
I want to ask a basic Question.
I have to check weather a particular node exist in the XML file ..
 how can i check in XSLT..

thanks
Abhishek
 
Old January 24th, 2006, 05:08 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Assuming that EXP is a path expression that would select the node if it existed, you can write

<xsl:if test="EXP">
   ... the node exists
</xsl:if>

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old January 24th, 2006, 05:20 AM
Registered User
 
Join Date: Jan 2006
Location: bangalore, , India.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to abhishek verma
Default

thanks michael for such a prompt reply..

i have one more problem when i apply my xslt on a xml document.
then empty tag comes as <Code/>..
I want they should come tike <Code></Code>.

is there any way to do this...


Regards
Abhishek
HP Solutions
 
Old January 24th, 2006, 05:32 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

"<Code/>" and "<Code></Code>" (and for that matter "<Code />") are completely equivalent in XML, so you can't distinguish them on input or control which representation is used on output. There's no reason to, because any recipient of the XML will treat them identically.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old January 24th, 2006, 05:35 AM
Registered User
 
Join Date: Jan 2006
Location: bangalore, , India.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to abhishek verma
Default

 You are rit sir,
I want this only for the formatting purposes ..
Is there any way?


Regards
Abhishek
HP Solutions




Similar Threads
Thread Thread Starter Forum Replies Last Post
help, basic xslt Yanson XSLT 4 June 19th, 2007 06:45 AM
Please HELP Very Basic Question jkoe578 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 November 18th, 2006 10:06 AM
xslt basic question kgoldvas XSLT 2 January 25th, 2006 02:48 PM
basic question but..... Adam H-W Javascript How-To 2 February 10th, 2004 01:24 PM
Basic XSLT problem.... johrik XSLT 2 February 6th, 2004 09:13 AM





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