[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: problems with params and element selection

Subject: Re: problems with params and element selection
From: "Joerg Heinicke" <joerg.heinicke@xxxxxx>
Date: Sat, 6 Apr 2002 03:21:35 +0200
object required elem in vbscript
> 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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.