Re: [xsl] Can i use apply-templates to match a xsl:template eleme nt?

Subject: Re: [xsl] Can i use apply-templates to match a xsl:template eleme nt?
From: "Aron Bock" <aronbock@xxxxxxxxxxx>
Date: Sat, 19 Mar 2005 16:17:51 +0000
Chris,

Going by the subjectline, if you want a template in an xstl stylesheet to find other elements in the same stylesheet, do something like the following:

   <xsl:template match="/">
       <xsl:for-each select="document('')/*/xsl:template">
           <xsl:value-of select="@match"/>
       </xsl:for-each>
   </xsl:template>

Here the document() function, with an empty-string, returns the containing xslt document...which is an xml document, and which we navigate as usual.

Needing to seach for an xsl:template within the same stylesheet can be useful if one od the "templates" actually holds some soft of mapping or lookup information which is best kept in-situ in the xslt document rather than in a separate file.

FYI, document('/') returns the main input xml document in similar fashion (at least under xalan).

Regards,

--A

From: Chris <phatfish@xxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Can i use apply-templates to match a xsl:template eleme nt?
Date: Sat, 19 Mar 2005 13:54:20 +0000


Thanks very much for the help. I dont think thats quite what i wanted
Maria, but i will look and see what you did, and check if it is any
help to me.

You see what im trying to do jay, but i think im confusing myself :) I
will make another thread that will hopefully be clearer and more
productive.

Thanks
On Fri, 18 Mar 2005 11:19:56 -0600, JBryant@xxxxxxxxx <JBryant@xxxxxxxxx> wrote:
> <xsl:apply-templates match="releasepage"/>
>
> should be
>
> <xsl:apply-templates select="releasepage"/>
>
> Rushing too much today. Sorry.
>
> Jay Bryant

_________________________________________________________________
Dont just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/


Current Thread