PDA

Click to See Complete Forum and Search --> : Resolved: XSL String test


richy
Dec 2nd, 2004, 09:48 AM
Hopefully I'm asking this in the right place. I have the following code:



<xsl:if test="/products/product/bookingweb != ''">
<a><xsl:attribute name="href">http://<xsl:value-of select="/products/product/bookingweb" disable-output-escaping="yes" /></xsl:attribute><xsl:attribute name="target">_blank</xsl:attribute>
<img class="linklist-image">
<xsl:attribute name="src">images\bookonline_image.gif</xsl:attribute>
<xsl:attribute name="border">0</xsl:attribute>
</img>
</a><br />
</xsl:if>



Rather than putting the html at the beginning of the booking web string automatically, I want to check whether the first 7 letters are http://. Now I don't know xsl very well at all, but its for this project in work. Can anybody help as to how I do this?


Thanks very much

richy
Dec 2nd, 2004, 10:09 AM
I've sorted it. Incase anyone cares...




<xsl:choose>

<xsl:when test="starts-with /products/product/bookingweb,'http://')">

</xsl:when>
<xsl:otherwise>
http://
</xsl:otherwise>
</xsl:choose>