View Single Post
  #1 (permalink)  
Old August 20th, 2014, 12:04 AM
JohnBampton JohnBampton is offline
Friend of Wrox
Points: 533, Level: 8
Points: 533, Level: 8 Points: 533, Level: 8 Points: 533, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2009
Posts: 119
Thanks: 25
Thanked 3 Times in 3 Posts
Default escape double quote into two double quotes

I need to create a CSV file from some XML. I can use XSLT 2.0.

I am placing quotes around my fields as some of them contain commas.

But in some of my XML fields I have XML like this ->

<linkHtml href="#TRIALS">CLINICAL EFFICACY TRIALS</linkHtml>

I need to somehow escape each double quote into two double quotes or similar so that Excel will read the CSV file properly and not mess up all my columns.

This is the XSLT code that matches on the element.

<xsl:template match="hl7:linkHtml | linkHtml">
<a href="{@href}">
<xsl:apply-templates></xsl:apply-templates>
</a>
</xsl:template>

Does anyone have a suggestion on how to approach this?

Regards, John.
The Following User Says Thank You to JohnBampton For This Useful Post: