Subject: RE: [xsl] regarding xpath From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx> Date: Wed, 24 Apr 2002 14:29:32 +0100 |
In the context of your source document, all three expressions are equivalent. They would be different if, for example, there was a <college> element that wasn't a child of the <colleges> element. In general, if you know the exact path and you know that it's not going to change, then in a select expression you should use it: /colleges/college/name. Otherwise the system has to search parts of your document where the required elements can't possibly occur. Michael Kay Software AG home: Michael.H.Kay@xxxxxxxxxxxx work: Michael.Kay@xxxxxxxxxxxxxx > -----Original Message----- > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of william > locksman > Sent: 24 April 2002 10:40 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] regarding xpath > > > > hi i have the following problem > have an xml file that looks like > <colleges> > > <college id = "1"> > <name>A College</name> > </college> > > <college id = "2"> > <name>B College</name> > </college> > > <college id = "1"> > <name>C College</name> > </college> > > </colleges> > > to print the college names, > if i write an XPATH expression like > ----------------------------------------------- > <xsl:for-each select="/colleges/college/name"> > <xsl:value-of select="."/>. > </xsl:for-each> > ----------------------------------------------- > OR > ----------------------------------------------- > <xsl:for-each select="//colleges/college/name"> > <xsl:value-of select="."/>. > </xsl:for-each> > ----------------------------------------------- > OR > ----------------------------------------------- > <xsl:for-each select="//college/name"> > <xsl:value-of select="."/>. > </xsl:for-each> > ----------------------------------------------- > > for all the above XPATH expressions in select , i seem to be > getting the names. If so then what is the significant difference > between the three statements?? > > > the above code is in <xsl:template match = "/"> ( from root ) > > thanks > _________________________________________________________ > Click below to visit monsterindia.com and review jobs in India or > Abroad > http://monsterindia.rediff.com/jobs > > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] regarding xpath, Matt Gushee | Thread | [xsl] xpath // query, Andrew Welch |
[xsl] exslt str:tokenize, Nicolas Mazziotta | Date | RE: [xsl] xpath // query, Michael Kay |
Month |