Re: [xsl] Howto generate a list xpath queries that are used within a template?

Subject: Re: [xsl] Howto generate a list xpath queries that are used within a template?
From: "cking" <cking@xxxxxxxxxx>
Date: Sun, 22 Aug 2004 16:34:08 +0200
Hi Joren,

I don't know why you would use a named template without params here,
but anyway, instead of checking the attributes in an xsl:choose construct,
you could simply test on all attributes: 

<xsl:template ...>
  <xsl:apply-templates select="@*"/>
</xsl:template>

<xsl:template match="@mode | @name"/>  <!-- skip these: not used for XPath -->

<xsl:template match="@*">
  <li><xsl:value-of select="."/></li>
</xsl:template>

Sorry if this is of no help to you, I have no idea how the rest of your stylesheet
is organized (eg. from where are you calling the "generateUsedXpathQueries" 
template?)

I don't think there's a way to check if an attribute value is an XPath expression
or not, because it could be anything, even a single word like "elemname"

BTW. some time ago I made an xsl-to-html stylesheet, too:
http://users.telenet.be/cking/webstuff/xdoc/xdoc.xsl
you can use this, or portions of it, if you want

Best regards
Anton Triest

Sunday, August 22, 2004 3:25 PM, Joren Crauwels wrote:
> for a school project i have to generate a html file containing metadata
> about an xslt file. So i have a file xslt2html.xsl that has can do this. A
> thing that has to be possible is to generate a list of all the templates and
> for each template i have to generate more detailed information. t has to be
> possible to generate a list of used xpath queries within a template. For the
> moment, i use a template like this to do that:
> 
> <xsl:template name="generateUsedXpathQueries">
>         <xsl:variable name="bla1" select="'joren'"/>
>         <xsl:choose>
>             <xsl:when test="@select">
>                 <li><xsl:value-of select="@select"/></li>
>             </xsl:when>
>             <xsl:when test="@test">
>                 <li><xsl:value-of select="@test"/></li>
>             </xsl:when>
>         </xsl:choose>
> </xsl:template>
> 
> The problem with this solution is that i will miss xpath queries that arent
> used in a select or test attribute. Does anyone know how i can generate a
> list that doesnt leave any xpath queries out? is there a way to check if the
> value of an attribute is a xpath-query or not?

Current Thread