Subject: Re: [xsl] problems with params and element selection From: "Joerg Heinicke" <joerg.heinicke@xxxxxx> Date: Sat, 6 Apr 2002 03:21:35 +0200 |
> Hi all > > i allways get the following error, when i try to use a param (which i get > trough an asp file with ...Processor.addParameter "page", page...) to apply > a specified template (like: <xsl:apply-templates > select="document/page[@name=$pp]"/> ). it's not a problem to use > <xsl:value-of select="$page" />! it shows the right value of the param. > "page" (so the asp is doing right). but i think it should also work with the > select statement, shouldn't ?! thx for any help! : > Description: Object required Source: Microsoft VBScript runtime error424 Of course, it should work within apply-templates and value-of. If you have "document/page[@name=$page]" and not as above $pp, every thing is ok with apply-templates. > Detailed xsl code: > ************************************************** > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > version="1.0"> > <xsl:param name="page" /> > <xsl:template match="/"> > <html> > <head> > </head> > <body> > <table> > <tr> > <xsl:for-each > select="document/page"> > <td><a><xsl:attribute > name="href">showme.asp?page=<xsl:value-of select="@name" > /></xsl:attribute><xsl:value-of select="@name" /></a></td> Off topic: You can short this with Attribute Value Template. AVT are written with {}: <a href="showme.asp?page={@name}"><xsl:value-of select="@name"/></a> > </xsl:for-each> > </tr> > </table> > <xsl:apply-templates > select="document/page[@name=$page]"/> > </body> > </html> > </xsl:template> The problem is here: > <xsl:template match="document/page[@name=$page]"> > <h1><xsl:value-of select="title/@name" /></h1> > </xsl:template> > </xsl:stylesheet> You can not use a variable in the match-attribute of a template. If you easily remove the [], it shell work. You apply templates only on these page-elements, which fulfill the condition. So you don't need the condition again here. If you have a second template matching on page-elements, you can work with modes. Regards, Joerg XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] problems with params and elem, Jan Krattiger | Thread | [xsl] Re: Re: Re: Re: Increment/dec, Dimitre Novatchev |
Re: [xsl] Filling table cells with , Joerg Heinicke | Date | Re: [xsl] Changing boolean value of, Joerg Heinicke |
Month |