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 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
Reply With Quote
  #2 (permalink)  
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: 100%
Activity: 100% Activity: 100% Activity: 100%
 
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
Reply With Quote
  #3 (permalink)  
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
Reply With Quote
  #4 (permalink)  
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: 100%
Activity: 100% Activity: 100% Activity: 100%
 
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
Reply With Quote
  #5 (permalink)  
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
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
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



All times are GMT -4. The time now is 06:19 AM.


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