Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 6th, 2007, 11:55 AM
TPP TPP is offline
Authorized User
 
Join Date: Mar 2006
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default "multiconditional" for-each ??

Hi,
I need a nested for-each but the "inner-one" refers to a node whose name can come in 2 in xsd defined names (example "name" and "eman").

Is it possible to do a for-each for 2 differently named nodes??
At there is a 500lines and i would not like copypaste it if its not necessary.


xml:
<root>
<element>
<name></name>
<name></name>
<name></name>
</element>
<element>
<eman></eman>
<eman></eman>
<eman></eman>
</element>
</root>

xslt:
<xsl:for-each select="//root/element">
<xsl:for-each select="name or eman">

</xsl:for-each>
</xsl:for-each>

THANKS :)

 
Old March 6th, 2007, 12:27 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Sure, use the union operator "|" that is

 select="name|enam"

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.