cancel
Showing results for 
Search instead for 
Did you mean: 

CR2008 - XSLT not being applied

Former Member
0 Kudos

Hello

Crystal Reports 2008 SP0

I have created a customer XSLT and imported it into a report

When i export the report using XML, and then select My xslt as the transform option, the outputted file is identical to the file generated when i use the Crystal Reports default transform

The workflow i expect is

Report --> Crystal Reports default xml format --> my custom xslt transform --> output similar to CSV

The transform expected by my custom xslt is not happening

Steps to import the cslt file:

File > Export > Manage XML Exporting formats > Add

Enter a name

Enter CSV as the Outpur file extension

Import XML Transform and choose the file listed below

Any help would be great thanks

Best regards

Patrick Coote

The xslt file is below:


<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:b="urn:crystal-reports:schemas:report-detail">
<xsl:output method="text" encoding="utf-8" indent="no"/>
<xsl:template match="/b:CrystalReport">
<xsl:text>"CODE","DESCRIPTION","AMOUNT"</xsl:text>
<xsl:text></xsl:text>
	<xsl:for-each select="b:Details">
		<xsl:text>"</xsl:text>
		<xsl:value-of select="b:Section/b:Field[@Name="CODE1"]/b:Value"/>
		<xsl:text>",</xsl:text>
		<xsl:text>"</xsl:text>
		<xsl:value-of select="b:Section/b:Field[@Name="DESCRIPTION1"]/b:Value"/>
		<xsl:text>",</xsl:text>
		<xsl:text>"</xsl:text>
		<xsl:value-of select="b:Section/b:Field[@Name="AMOUNT1"]/b:Value"/>
		<xsl:text>"</xsl:text>
	</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Oops

These lines

<xsl:value-of select="b:Section/b:Field[@Name="CODE1"]/b:Value"/>

should read as

<xsl:value-of select="b:Section/b:Field[@Name='CODE1']/b:Value"/>

That is, single quotes around the field names

former_member183750
Active Contributor
0 Kudos

I know this is an old, old post. Just came across it doing other searches, so thought I'd fill in the blanks...

Update to SP5:

http://scn.sap.com/docs/DOC-27917

And see the blog Crystal Reports 2008 - Simplify Management of XML Export Formats

- Ludek

Follow us on Twitter

Got Enhancement ideas? Try the SAP Idea Place

Share Your Knowledge in SCN Topic Spaces

Answers (0)