Sign in to follow this  
Followers 0
DrtyRdr

XSL/cXML Assistance - Remove a dash

4 posts in this topic

Hello all,

Noob here, learning the basics of XSL's and cXML, so please be gentle!

 

I work with an eprocurement solution which uses XSL to general cXML for posting things like punchout requests, cXML purchase orders and invoices...etc. I am in need of suggestions on how to accomplish the following.

 

I am using the following attribute in my XSL to pull and display an order number in the resulting cXML invoice. The line I am using is:

 

<xsl:attribute name="invoiceID">
<xsl:value-of select="PurchaseOrderInvoice/OrderGraph/PartialOrderNumber"/>
</xsl:attribute>

 

This line results in the following cXML line:

invoiceID="668916-0"

 

The number listed is the order number generated by the ERP, and the ERP will always include the dash at the end. What I am wanting to do is remove the dash between the 6 and 0, to output the results to just:

invoiceID="6689160"

 

Is this possible, and if so, how?

 

Thanks very much.

 

Share this post


Link to post
Share on other sites

XSL is a styling language, its capabilities of actually modifying data are very limited. You might want to look into a programming solution with a server-side programming language, or Javascript if you're on the client side.

Share this post


Link to post
Share on other sites

XSL is a styling language, its capabilities of actually modifying data are very limited. You might want to look into a programming solution with a server-side programming language, or Javascript if you're on the client side.

Thank you for the reply. I will have to get with my development team to see if a programming solution is possible. I was hoping to take care of it easily in the XSL. Thanks much.

Share this post


Link to post
Share on other sites

Just posting back here for posterity, and just in case someone else is looking to do the same thing.

 

I was able to get the output needed by using the translate command:

 

I changed this:

<xsl:attribute name="invoiceID">
<xsl:value-of select="PurchaseOrderInvoice/OrderGraph/PartialOrderNumber"/>
</xsl:attribute>

 

To this:

<xsl:attribute name="invoiceID">
<xsl:value-of select="translate(PurchaseOrderInvoice/OrderGraph/PartialOrderNumber,'-','')"/>

</xsl:attribute>

 

And my output went from this invoiceID="668916-0" to this invoiceID="6689160"

 

Thanks!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0