[xsl] weird formatting and characters with <xsl:text disable-output-escaping>

Subject: [xsl] weird formatting and characters with <xsl:text disable-output-escaping>
From: Spencer Tickner <spencertickner@xxxxxxxxx>
Date: Tue, 26 Apr 2005 10:39:40 -0700
Hello everyone and thank's in advance for you're help.

I have a pretty simple little xsl that is translating some xml into
text to be imported to inDesign. The problem is using the <xsl:text
disable-output-escaping> is causing my output to be horrendous. To the
point that inDesign will not except it. Carriage returns are being
shown as unknown characters and lines run as long as textpad will
allow them. I realize this is what I should expect from
disable-output-escaping, but if you anyone has any suggestions to get
some better output. I would really appreciate it.

Here is my xsl:


<?xml version='1.0'?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:key name="grouped_regions" match="table/eddoc" use="edcode"/>
<xsl:output method="text" name="text" omit-xml-declaration="yes"
encoding="us-ascii"/>


<xsl:template match="/">

	<xsl:for-each select="table/eddoc[count(. | key('grouped_regions',
edcode)[1]) =1]">
		<xsl:sort select="edcode"/>

		<xsl:variable name="mycode" select="edcode"/>

		<xsl:variable name="filename">
			<xsl:value-of select="concat('file:///W:/Statutes/Source/Tagged/',
$mycode, '.txt')"/>
		</xsl:variable>

		<xsl:result-document href="{$filename}" format="text">

		<xsl:text disable-output-escaping="yes">
		&lt;ASCII-WIN&gt;
		&lt;Version:3.000000&gt;
		&lt;FeatureSet:InDesign-Roman&gt;&lt;ColorTable:=&lt;Black:COLOR:CMYK:Proce
ss:0.000000,0.000000,0.000000,1.000000&gt;&lt;Paper:COLOR:CMYK:Process:0.0000
00,0.000000,0.000000,0.000000&gt;&gt;
		&lt;DefineParaStyle:File Name=&lt;Nextstyle:File
Name&gt;&lt;cTypeface:Bold&gt;&lt;cSize:7.000000&gt;&lt;cLeading:14.000000&gt
;&lt;pHyphenation:0&gt;&lt;pHyphenateCapitals:0&gt;&lt;pSpaceAfter:6.000000&g
t;&lt;cFont:Arial&gt;&gt;
		&lt;DefineParaStyle:Line 3 Registered Political
Party=&lt;BasedOn:Line 2 First Name \&amp;amp;
Surname&gt;&lt;Nextstyle:Line 1
Surname&gt;&lt;pSpaceAfter:24.000000&gt;&gt;
		&lt;DefineParaStyle:Line 2 First Name \&amp;amp;
Surname=&lt;BasedOn:Line 1 Surname&gt;&lt;Nextstyle:Line 3 Registered
Political
Party&gt;&lt;cSize:12.000000&gt;&lt;cCase:Normal&gt;&lt;pSpaceAfter:0.000000&
gt;&gt;
		&lt;DefineParaStyle:Line 1 Surname=&lt;Nextstyle:Line 2 First Name
\&amp;
Surname&gt;&lt;cColor:Paper&gt;&lt;cTypeface:Bold&gt;&lt;cSize:20.000000&gt;&
lt;cCase:All
Caps&gt;&lt;cLeading:14.000000&gt;&lt;pHyphenation:0&gt;&lt;pHyphenateCapital
s:0&gt;&lt;pSpaceAfter:6.000000&gt;&lt;cFont:Arial&gt;&lt;pTextAlignment:Righ
t&gt;&gt;
		</xsl:text>

		<xsl:text disable-output-escaping="yes">
		&lt;ParaStyle:File Name&gt;</xsl:text><xsl:value-of select="edcode"/>
		<xsl:text disable-output-escaping="yes">
		&lt;ParaStyle:File Name&gt;</xsl:text><xsl:value-of select="edname"/>


		<xsl:for-each select="key('grouped_regions', edcode)">
			<xsl:sort select="sequence"/>
				<xsl:text disable-output-escaping="yes">
					&lt;ParaStyle:Line 1 Surname&gt;</xsl:text><xsl:value-of
select="edlastname"/>
				<xsl:text disable-output-escaping="yes">
					&lt;ParaStyle:Line 2 First Name \&amp;
Surname&gt;</xsl:text><xsl:value-of select="edballname"/>
				<xsl:text disable-output-escaping="yes">
					&lt;ParaStyle:Line 3 Registered Political
Party&gt;</xsl:text><xsl:value-of select="edpartbalname"/>
		</xsl:for-each>

	</xsl:result-document>
	</xsl:for-each>

</xsl:template>
</xsl:stylesheet>


A sample of my xml

<table xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:noNamespaceSchemaLocation="ballot.xsd">
	<eddoc>
		<edcode>ABC</edcode>
		<edname>SomeWhere</edname>
		<edballname>Some guy</edballname>
		<edpartbalname>That Party</edpartbalname>
		<edlastname>guy</edlastname>
		<edsequence>1</edsequence>
	</eddoc>
	<eddoc>
		<edcode>ABC</edcode>
		<edname>SomeWhere</edname>
		<edballname>The Other guy</edballname>
		<edpartbalname>This Party</edpartbalname>
		<edlastname>other guy</edlastname>
		<edsequence>2</edsequence>
	</eddoc>
</table


Ultimately I would love it if the output from all of this would be
something like this:

<ASCII-WIN>
<Version:3.000000>
<FeatureSet:InDesign-Roman><ColorTable:=<Black:COLOR:CMYK:Process:0.000000,0.
000000,0.000000,1.000000><Paper:COLOR:CMYK:Process:0.000000,0.000000,0.000000
,0.000000>>
<DefineParaStyle:File Name=<Nextstyle:File
Name><cTypeface:Bold><cSize:7.000000><cLeading:14.000000><pHyphenation:0><pHy
phenateCapitals:0><pSpaceAfter:6.000000><cFont:Arial>>
<DefineParaStyle:Line 3 Registered Political Party=<BasedOn:Line 2
First Name \& Surname><Nextstyle:Line 1
Surname><pSpaceAfter:24.000000>>
<DefineParaStyle:Line 2 First Name \& Surname=<BasedOn:Line 1
Surname><Nextstyle:Line 3 Registered Political
Party><cSize:12.000000><cCase:Normal><pSpaceAfter:0.000000>>
<DefineParaStyle:Line 1 Surname=<Nextstyle:Line 2 First Name \&
Surname><cColor:Paper><cTypeface:Bold><cSize:20.000000><cCase:All
Caps><cLeading:14.000000><pHyphenation:0><pHyphenateCapitals:0><pSpaceAfter:6
.000000><cFont:Arial><pTextAlignment:Right>>
<ParaStyle:File Name>ABC
<ParaStyle:File Name>SomeWhere
<ParaStyle:Line 1 Surname>guy
<ParaStyle:Line 2 First Name \& Surname>Some Guy
<ParaStyle:Line 3 Registered Political Party>That Party
<ParaStyle:Line 1 Surname>other guy
<ParaStyle:Line 2 First Name \& Surname>Some other guy
<ParaStyle:Line 3 Registered Political Party>This Party


I could paste the output I'm getting now, but it's so out of this
world that this email box won't do it justice.

Anyway, any advice or help you can offer would be much appreciated.

Spencer

Current Thread