Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: xpath problems? >Thread Next - Re: xpath problems? Re: xpath problems?To: NULL Date: 6/3/2006 9:50:00 AM On Fri, 02 Jun 2006 23:43:30 +0200, Jeremy Chapman <please@Idontlikespam= > = wrote: > Are you saying the <xsl:value-of > select=3D"/*[local-name()=3D'config']/*[local-name()=3D'xsddocs']/@hre= f"/> > statement is working on the $doc nodeset because of the <for-each that= = > its in? He would be correct in saying that > If so, how would I work on the non external document? You could "backup" your original document context by saving it in a = variable: <xsl:variable name=3D"this" select=3D"/"/> <xsl:for-each select=3D"$doc/*[local-name()=3D'schema']/*[local-name()=3D'element'][@n= ame=3D$strRootReference]/*[local-name()=3D'complexType']/*[local-name()=3D= 'sequence']/*[local-name()=3D'element']"> <xsl:value-of = select=3D"$this/*[local-name()=3D'config']/*[local-name()=3D'xsddocs']/@= href"/> </xsl:for-each> On a sidenote, what's with all the local-name()'s? Wouldn't = "$doc/sxd:schema/sxd:element[@name=3D$strRootReference]/sxd:complexType/= sxd:sequence/sxd:element" = be more readable? > "Anthony Jones" <Ant@y...> wrote in message > news:uB2vLtohGHA.4252@T...... >> >> "Jeremy Chapman" <please@Idontlikespam> wrote in message >> news:u3cEN%23lhGHA.1000@T...... >>> Code snippet below (shortened for illustration purposes) >>> My problem is that if I move the <xsl:value-of statement to the firs= t >>> line >>> under <xsl:template match=3D"/"> then it returns the @href attribute= as I >>> would expect. But if I leave it as shown below, it doesn't return = a >> value, >>> but I don't understand why. Can someone shed some light? >>> >>> <xsl:template match=3D"/"> >>> <xsl:call-template name=3D"processSegmentDetails" > >>> </xsl:template> >>> >>> <xsl:template name=3D"processSegmentDetails"> >>> <xsl:for-each >>> >> select=3D"$doc/*[local-name()=3D'schema']/*[local-name()=3D'element']= [@name=3D$strRo >> otReference]/*[local-name()=3D'complexType']/*[local-name()=3D'sequen= ce']/*[loca >> l-name()=3D'element']"> >>> <xsl:value-of >>> select=3D"/*[local-name()=3D'config']/*[local-name()=3D'xsddocs']/@h= ref"/> >>> </xsl:template> >>> >>> >> >> Where does $doc get it's nodes from? >> >> > > Quidquid latine scriptum sit, altum viditur regards, -- = Joris Gillis (http://users.telenet.be/root-jg/me.html) Veni, vidi, wiki (http://www.wikipedia.org) | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
