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

Setting name attribute of <xsl:attribute>

Subject: Setting name attribute of <xsl:attribute>
From: "Witham, Darren (Contractor)" <withd2@xxxxxx>
Date: Fri, 10 Oct 2003 12:49:54 +0100
darren witham
Hi,

  I have what I hope is an easy issue to solve but my varying attempts to do so have not been successful. I have an xsl stylesheet which transforms some xml into another xml format.
  I only wish to generate XML in the output xml file if attributes in the src xml exist. At present I have a number of <xsl:if test......> directives to check if an attribute is present before processing.
  I would like to remove the need for the <xsl:if test......> and want to call a template to do the check and process if need be.....

  My template is 

      <!--
        Helper template that only pushes out out XML if value of attribute to publish is not null 
      -->
    <xsl:template name="checkAttributeNotNull">
        <xsl:param name="attributeName"/>
        <xsl:param name="attributeValue"/>
        <xsl:if test="$attributeValue">
          <xsl:attribute name="{$attributeName}">
	      <xsl:value-of select="$attributeValue" />
          </xsl:attribute>
        </xsl:if>
    </xsl:template>

 And I call if via :

  
<xsl:call-template name="checkAttributeNotNull">
     <xsl:with-param name="attributeName" select="anAttName"/>
     <xsl:with-param name="attributeValue" select="anAttValue"/>
 </xsl:call-template> 

  The problem I have is within the template I call.  I cannot seem to set the name of the attribute I am trying to create with the parameter 'attributeName'. ( i.e with <xsl:attribute name="{$attributeName}">)
 I have tried all sorts of combinations except for the correct one. I thought I could set this value at runtime ?????

Any pointers appreciated.

Thx

 

 

 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.