xsl-list
[Top] [All Lists]

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

2005-03-19 09:17:51
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(_at_)gmail(_dot_)com>
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
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(_at_)s-s-t(_dot_)com <JBryant(_at_)s-s-t(_dot_)com> wrote:
> <xsl:apply-templates match="releasepage"/>
>
> should be
>
> <xsl:apply-templates select="releasepage"/>
>
> Rushing too much today. Sorry.
>
> Jay Bryant

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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--