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

Re: Using a variable to check to see if that element exists

Subject: Re: Using a variable to check to see if that element exists in another xml doc.
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Mon, 07 Feb 2000 18:28:58 +0000
xsl if element exists
Laura:

At 03:52 PM 2/7/00 -0600, you wrote:

>I am trying to use the variable myKey to check to see if it's value (ie.
>"currencyCode") is an element in another document.
>I am having some problems.  does anyone know what is wrong with this xsl.
...
>Here is my xsl template::
><xsl:template match="object">
>     <xsl:for-each select="property">
>          <xsl:variable name="myKey" select="key"/>
>          <xsl:if test="$myKey='currencyCode'">
>               This works; try the next if
>               <xsl:if test="document('en_US.xml')/locale/$myKey">
>                    insert label
>               </xsl:if>
>          </xsl:if>
>
>           </xsl:for-each>
>  </xsl:template>

This looks like another of the "a string is not a node" variety of
slip-ups. The value of the assigned variable is a string. It can't be used
directly to select a node.

Inside your location path, try our old friend, *[local-name() = $myKey] to
match "each element whose local name is equal to the string $myKey" and see
how that works....

--Wendell Piez


======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


 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.