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

Accessing attribute in a variable with conditional val

Subject: Accessing attribute in a variable with conditional value
From: "Wasiq Shaikh" <wasiq911@xxxxxxxxxxx>
Date: Wed, 01 Aug 2007 13:41:22 -0400
 Accessing attribute in a variable with conditional val
Hi,

I'm setting a value on a variable using conditions. The variable must be a node-set so that I can do some processing with it.

     <xsl:variable name="validAttributeType">
        <xsl:if test="key('allTypes', @type)">
           <xsl:copy-of select="key('allTypes', @type)/xsd:restriction"/>
        </xsl:if>
        <xsl:if test="xsd:simpleType"
           <xsl:copy-of select="xsd:simpleType/xsd:restriction"/>
        </xsl:if>
     </xsl:variable>

The "xsd:restriction" tag has a "base" attribute that I need to access and send to a template as a parameter.

<xsl:call-template name="trimAttribute">
<xsl:with-param name="attributeName" select="'base'"/>
<xsl:with-param name="attribute" select="$validAttributeType/@base"/>
</xsl:call-template>


But it gives me a "XSLT Error (javax.xml.transform.TransformerException): org.apache.xpath.objects.XRTreeFrag" when I try to do

<xsl:with-param name="attribute" select="$validAttributeType/@base"/>
OR
<xsl:with-param name="attribute"><xsl:copy-of select="$validAttributeType/@base"/></xsl:with-param>


I can print out the variable's contents, which is correct, but I can't seem to access the attribute. By the way, previously I had this

<xsl:variable name="validAttributeType" select="key('allTypes', @type)/xsd:restriction"/>

which works! But adding the conditional messed it up. How can I get the same behaviour as the above line in a conditional variable?

I appreciate any help. Thank you!

_________________________________________________________________
Show Your Messenger Buddies How You Really Feel http://www.freemessengeremoticons.ca/?icid=EMENCA122


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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

Buy Stylus Studio Now

Cast Your Vote

We need your help – Vote for DataDirect XML Products!

  • Best SOA or XML site

Winners and finalists announced at SOA World Conference in November.

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-2007 All Rights Reserved.