Skip to Content
author's profile photo Former Member
Former Member

CR2008 - XSLT not being applied

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>

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Aug 04, 2009 at 10:55 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.