|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: text() pattern matching
I looked into the XPath spec. and realized this can be easily
solved using the substring function.
- Earl
I have having trouble with text that has
carriage returns within it and doing a match
on those values. I want to do the following:
xml file:
<docRoot>
<restaurant>
<name>Johns Great Restaurant
</name>
<review>great
</review>
</restaurant>
</docRoot>
xsl file:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"
xmlns:xt="http://www.jclark.com/xt"
extension-element-prefixes="xt">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="//restaurant">
<restaurantReviews>
<restaurantName> <xsl:value-of select="name"/> </restaurantName>
<xsl:element name="opinion">
<xsl:variable name="myOpinionValue">
<xsl:value-of select="review"/>
</xsl:variable>
<xsl:choose>
<xsl:when test='$myOpinionValue="excellent"'>5</xsl:when>
<xsl:when test='$myOpinionValue="great"'>4</xsl:when>
<xsl:when test='$myOpinionValue="good"'>3</xsl:when>
<xsl:when test='$myOpinionValue="ok"'>2</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:element>
</restaurantReviews>
</xsl:template>
</xsl:stylesheet>
Yet the carriage return/linefeed doesn't allow the match of myOpinionValue
to take place. What is the pattern match required here to try and get the
best value.
Thanks,
Earl
Earl Bingham
B-Bop Associates Inc.
2 North First Street
San Jose, CA 95113
Voice: (408) 993-2140
FAX: (408) 993-2141
XML SIG: http://www.sdforum.org/sigs/xml/index.html
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
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








