I'm trying to do custom export of Contour records to CSV file. I'm using XSLT macro to do it and everything seems ox except quotes. It turns out that quotes entered in Contour forms are stored in database as:
<![CDATA["Test quotes&]]>
I'm not sure why this is so, if CDATA is used I expected quotes to be left as are. but anyway, in my XSLT export, line <xsl:value-of select="created" disable-output-escaping="yes"/> creates output:
Also, you might have a look at /umbraco/plugins/umbracoContour/xslt/excel.xslt, which is an XSLT file that ships with Contour that converts records into CSV for Excel (used in the export dropdown). Might help you out.
I remember trying that too and it was worse. I also tried regular export (/umbraco/plugins/umbracoContour/xslt/excel.xslt) but that also does not export ok, although results are wierd: first quote is interpreted ok, and second one is just merged with couple of next fields.
Reason I'm talking in past tense is that I ran into another problem that does not allow me to test further. My export started returning no records. Debugging it with "visualise XSLT":
Ah, I don't know how above problem happened but somehow record in database was corrupted. XMLrecord text eded wit CDATA[". I deleted this record and now back in business... or better to say back to original problem and that is exporting text with quotes.
Suggestion above, to remove output escaping produces even worse results. "Test" is exported as:
&quot;Test&quot;;
So still, I don't know how to export quotes from Contour using XSLT macro.
How to get rid of " in Contour export
I'm trying to do custom export of Contour records to CSV file. I'm using XSLT macro to do it and everything seems ox except quotes. It turns out that quotes entered in Contour forms are stored in database as:
<![CDATA["Test quotes&]]>
I'm not sure why this is so, if CDATA is used I expected quotes to be left as are. but anyway, in my XSLT export, line <xsl:value-of select="created" disable-output-escaping="yes"/> creates output:
"Test quotes&
Which is not good for export file. It shold be:
"Test"
I don't know how to resolve this.
Hiya,
Try removing the disable output escaping property, that should render it with the quotes I think.
What Tim said :)
Also, you might have a look at /umbraco/plugins/umbracoContour/xslt/excel.xslt, which is an XSLT file that ships with Contour that converts records into CSV for Excel (used in the export dropdown). Might help you out.
-Tom
I remember trying that too and it was worse. I also tried regular export (/umbraco/plugins/umbracoContour/xslt/excel.xslt) but that also does not export ok, although results are wierd: first quote is interpreted ok, and second one is just merged with couple of next fields.
Reason I'm talking in past tense is that I ran into another problem that does not allow me to test further. My export started returning no records. Debugging it with "visualise XSLT":
<xsl:value-of select="umbraco.contour:GetRecordsFromForm('56984134-7139-453a-87d2-04e8f1ade00e')/uformrecord [state = 'Approved']"/>
... generates no output, while:
<xsl:value-of select="umbraco.contour:GetRecordsFromForm('56984134-7139-453a-87d2-04e8f1ade00e')"/>
generates this exception:
Error parsing the XSLT:
System.ArgumentException: '', hexadecimal value 0x12, is an invalid character. at System.Xml.XmlEncodedRawTextWriter.InvalidXmlChar(Int32 ch, Char* pDst, Boolean entitize) at System.Xml.XmlEncodedRawTextWriter.WriteElementTextBlock(Char* pSrc, Char* pSrcEnd) at System.Xml.XmlEncodedRawTextWriter.WriteString(String text) at System.Xml.Xsl.Runtime.XmlQueryOutput.WriteString(String text, Boolean disableOutputEscaping) at (XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) at Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) at Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime) at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlSequenceWriter results) at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer) at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, XmlWriter results, XmlResolver documentResolver) at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, TextWriter results) at umbraco.macro.GetXsltTransformResult(XmlDocument macroXML, XslCompiledTransform xslt, Dictionary`2 parameters) at umbraco.presentation.umbraco.developer.Xslt.xsltVisualize.visualizeDo_Click(Object sender, EventArgs e)
Ah, I don't know how above problem happened but somehow record in database was corrupted. XMLrecord text eded wit CDATA[". I deleted this record and now back in business... or better to say back to original problem and that is exporting text with quotes.
Suggestion above, to remove output escaping produces even worse results. "Test" is exported as:
&quot;Test&quot;;
So still, I don't know how to export quotes from Contour using XSLT macro.
is working on a reply...