• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

difference between select = "/" and select ="*"

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,
what is the difference between the 2?
I have a small xml doc:
<?xml version="1.0"?>
<player name="sachin" born="1974">
<inning score="155" year='2001'>
Rest Of World at ENG
<ground>LORDS</ground>
</inning>
<inning score="145" year='1998'>
Aussies at SHA
<ground>Sharjah</ground>
</inning>
<inning score="138" year='1998'>
Aussies at SHA
<ground>Sharjah</ground>
</inning>
<inning score="145" year='1996'>
Aussies at Sydney
<ground>SCG</ground>
</inning>
</player>
if i apply the follwing xsl,
<xsl:template match="/">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
i do not get the element names printed..only the elemnt contents..
But if i do
<xsl:template match="*">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
then the entire document tree gets printed.
thanks
prav

 
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
/ selects the root node of the document, whereas * selects all the elements.
 
prav mane
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks..
i have
<xsl:template match="/">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
now <xsl:apply-templates/> selects all the child elements right?
I don't have any other template as well.
So is'nt this same as selecting *.
i'm totally confused.
thanks,
prav.

Originally posted by Menon Hema:
/ selects the root node of the document, whereas * selects all the elements.


 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic