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

RE: Is there a way in xsl to point to a node if only a

Subject: RE: Is there a way in xsl to point to a node if only apart of its name is known?
From: Joshua.Kuswadi@xxxxxxxxxxxxxxxxxxxx
Date: Thu, 22 Nov 2001 14:13:33 +1100
xsl node name wildcard
Michael wrote: 
> Is there a way in xsl to point to a node if only a part of its name is
> known?

>From what I know, there is no wildcard to partially match node names. The only thing close is select="*" which will select all elements. You could try using the XPath name() or local-name() function to return the node name as a string and then test if for what ever you need.

> Sample xml 1:
> <node1>
>   <node2>
>     <node3>
>       <tableName1.field1>content ...</tableName1.field1>
>       <tableName1.field2>content ...</tableName1.field2>
>       <tableName1.field3>content ...</tableName1.field3>
>     </node3>
>   </node2>
> </node1>

eg a template for the above XML sample (Note: This is untested, no guarantees ;-)
<xsl:template match="node3">
 <xsl:for-each select="*">
  <!-- Should select the fieldname after the dot, '.', in the element name
  <xsl:variable name="fieldname" select="substring-after(local-name(), '.')" />
  <xsl:if test="$fieldname = 'foo'">
   <!-- Do stuff when element has 'foo' as the fieldname
  </xsl:if>
 </xsl:for-each>
</xsl:template>

HTH,
Joshua

------------------------------------------------------------------------------
This message and any attachment is confidential and may be privileged or otherwise protected from disclosure.  If you have received it by mistake please let us know by reply and then delete it from your system; you should not copy the message or disclose its contents to anyone.





 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.