[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Question:from Michael Kay's Book

Subject: Question:from Michael Kay's Book
From: subbu@xxxxxxxxxxxx
Date: Wed, 26 Jun 2002 15:42:47 +0100
 Question:from Michael Kay's Book
I was going through XSLT Reference and got struck up in the page num 331 in the 
First Edition..

The following is what i read..
<<//@width/..>> selects all the elements in the document that have a width 
attribute.

would this mean that if i have a xml file that looks like..
<rooms>
 <room width = "1">
  my room 1
 </room>
 <room width = "2">
  my room 2
 </room>
  <room width = "3">
  my room 3
 </room>
  <room width = "4">
  my room 4
 </room>
</rooms>

then an XSL code like
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:value-of select="//@width/.."/><br/>
</xsl:template>
</xsl:stylesheet>

should return me all the rooms text like
my room 1
my room 2
my room 3
my room 4..

I am definitely sure i am getting it wrong.. I shud be thankful if some one can 
please let me know what the statement
"<<//@width/..>> selects all the elements in the document that have a width 
attribute "
means..

To get all the rooms with a width, i was thinking of doing something along the 
lines of
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:for-each select="/rooms/room[@width]">
<xsl:value-of select="."/><br/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

I am a bit confused about the above mentioned statement that i read in the book.
I shud be grateful if someone(possibly Mr Kay) clears my doubt..I think i am 
missing something here..

Thanks
subbu


--------------------------------------------------------------
Sent with "Me-Mail", Boltblue's FREE mobile messaging service.
http://www.boltblue.com


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.