|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
I have one scenario with my question/problem: my XML gives output of 20 items but I wish to select 3 specific items. I know command for selecting only one item in XSL for each: Code:
<xsl:for-each select="something/somefileld[field='some']"> How to set in XSL to display 3 specific (or more) items in XSL, but not whole list of 20 items? Above code only works for one specific, I need 3 of them (allso specific). thx in advance, Echo |
|
#2
|
|||
|
|||
|
Use the or operator. Something like
[field='some1' or field='some2' or field3='some3'] Here is a simple example: Code:
<?xml version="1.0"?> <root> <element name="1">1</element> <element name="2">2</element> <element name="3">3</element> <element name="4">4</element> </root> Code:
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match = "/">
<xsl:for-each select="//element[@name='1' or @name='2' or @name='4']">
<xsl:value-of select="@name" />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > XSL selecting more then one item/help-advice |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|