Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can someone help me with this find and replace in XSL? 1

Status
Not open for further replies.

kellstee

Technical User
Dec 31, 2005
37
US
Hopefully, I'm saying all of this right. . .I don't know much about this code at all.

We have a small shipping program where we can write custom invoices in XSLT (I thought it was XSLT, but maybe just XSL). I have a field that is pulled in at the end of the invoice: Order Notes. This will contain special notes written by the customer. Sometimes the data in this field contains the phrase "Buyer Notes:" before the customer data but sometimes not. If the data contains "Buyer Notes:", I don't want it pulled into the invoice.

We had a piece of code like this:

<xsl:template name="outputPageFooter">
<br> </br>
<table id="orderdetails" cellspacing="0">

<tr class="header">
<td>Special Instructions</td>
</tr>

<tr class="orderitem">
<td><xsl:value-of select="substring-after(//Order/Notes, 'Buyer notes:')" /></td>
</tr>

</table>
<br> </br>

However, we were finding that sometimes the order notes were missing altogether when the invoice printed. I'm guessing I need a more sophisicated statement that only removes the text "Buyer's Notes:" when it is actually in the field?

Can anyone help?
 
>[tt]<td><xsl:value-of select="substring-after(//Order/Notes, 'Buyer notes:')" /></td>[/tt]

Maybe, replace it by this.
[tt]
<td><xsl:choose>
<xsl:when test="contains(//Order/Notes,'Buyer notes:')">
<xsl:value-of select="substring-after(//Order/Notes,'Buyer notes:')" />
</xsl:when>
<xsl:eek:therwise>
<xsl:value-of select="//Order/Notes" />
</xsl:eek:therwise>
</xsl:choose></td>
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top