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

RE: parameters - element vs attributes

Subject: RE: parameters - element vs attributes
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Thu, 3 Jun 2004 17:10:48 +0100
xsl parameters
The construct you are looking for (you're not the first) is

*[name()=$param]

which selects all child elements whose name is equal to $param.

Michael Kay 

> -----Original Message-----
> From: stephen.peterson@xxxxxxxxxxxxx 
> [mailto:stephen.peterson@xxxxxxxxxxxxx] 
> Sent: 03 June 2004 14:12
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  parameters - element vs attributes
> 
> Hi there, 
> I'm kind of new to XML and I'm trying to figure out how I can use a
> parameter (theLinkGroup) to select an element when used in 
> another template.
> I have used it (a parameter in another template) to select an 
> element based
> on the value of it's attribute before. But I keep getting a 
> error about
> "NodeTest expected here" and showing me the beginning of my select
> statement.
> 
> In the past I have used a parameter called "themeSubject" and 
> used it in
> another template to select an element with the attribute 
> having the smae
> value of the parameter. An it worked fine. <e.g.> <xsl:with-param
> name="themeSubject" select="'GIS'"/> ... in other template 
> ... <xsl:for-each
> select="//siteLinkList/link[themeType/item=$themeSubject]">
> </e.g.>
> 
> Can someone point me to a resource that will explain this to 
> me? I know
> there are some restrictions on what you can do with 
> parameters and paths.
> 
> Many thanks, 
> MNR Steve
> 
> 
> Here is most of my current code....
> 
> <xsl:template match="/">
>    <xsl:call-template name="siteLinks">
>      <xsl:with-param name="theLinkGroup" 
> select="'siteLinkList'"/>  <!--
> parameter
>    </xsl:call-template>
> </xsl:template>
> 
> <!-- other templates -->
> <!-- other templates -->
> 
> <xsl:template name="siteLinks">
> <xsl:param name="theLinkGroup"></xsl:param>
>  <h2><xsl:value-of select="$theLinkGroup" /></h2>           
> <!----- does
> work
>   <ul class="xsmall">
>   <xsl:for-each select="//$theLinkGroup/link">                
>    <!-----
> won't work
>    <li><a>
>     <xsl:attribute name="href"><xsl:value-of 
> select="url"/></xsl:attribute>
>      <xsl:value-of select="@title"/>
>     </a></li>
>   </xsl:for-each>
>   </ul>
> </xsl:template>
> 
> --+------------------------------------------------------------------
> 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@xxxxxxxxxxxxxxxxxxxxxx>
> --+--
> 
> 



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.