|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Using | with multiple attribute values
Hello,
Given the following XML snippet:
<Records>
<Record name="John">
</Records>
I would like to output "Smith" if the "name" attribute is "John" or "Joe". I
can do this with this XSL snippet:
<xsl:for-each select="Records/Record">
<xsl:if test="@name='John'">Smith</xsl:if>
<xsl:if test="@name='Joe'">Smith</xsl:if>
</xsl:for-each>
However, I would like to use a compound conditional and do this in one line.
I have tried this:
<xsl:if test="@name='John|Joe'">Smith</xsl:if>
But that doesn't work.
I have also tried this:
<xsl:if test="@name='John'|'Joe'">Smith</xsl:if>
or this:
<xsl:if test="@name='John'|@name='Joe'">Smith</xsl:if>
In both of these cases, the parser I am using (Lotus XSL with XML4J)
crashes. If this is a flaw in LotusXSL then it is not meant as a criticism.
I realize that the product is pre-Beta ("Developer Preview") and this is the
first problem I have had with it.
Is LotusXSL simply failing with my correct syntax? If so, can anyone think
of an alternative work-around? If not, is there a better way of doing this?
Thanks,
Ross
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








