View Single Post
  #1 (permalink)  
Old August 2nd, 2007, 08:07 AM
Pankaj C Pankaj C is offline
Authorized User
 
Join Date: Jul 2007
Location: New Delhi, Delhi, India.
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Default XSL:output method="text"


Hi all,

I've just started writting my stylesheet for transforming the CALS table into sort of tagged text coding (using <xsl:output method="text">for Indesign), but started getting error at very nascent stage.

ERROR IS: XSL element "template" can be used only on top level


Below is the snippet of my table (I am cutting it short just to give a brief idea )

<?xml version="1.0"?><table id="id_0070956545_001_000195" frame="none" type="numbered" extra-info="Table 1.1">
<title id="id_0070956545_001_000196">Production Possibilities Schedule</title>
<tgroup cols="3">
<colspec colnum="1" colname="c2" align="right"/>
<colspec colnum="2" colname="c2" align="left"/>
<colspec colnum="3" colname="c3" align="char" char="."/>
<thead >
<row>
<entry>as</entry>
<entry>Production of Wheat (Metric tonnes / year)</entry>
<entry>Production of Softwood Lumber (Millions of board-feet / year)</entry>
</row>
</thead>
<tbody id="id_0070956545_001_000202">
.
.
.
.
.</table>

Below is my style sheet:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text"/>
<xsl:template match="table">&lt;ASCII-MAC&gt;
&lt;Version:4&gt;&lt;FeatureSet:InDesign-Roman&gt;&lt;ColorTable:=&lt;Black:COLOR:CMYK:Proc ess:0,0,0,1&gt;&gt;
&lt;DefineParaStyle:NormalParagraphStyle=&lt;Nexts tyle:NormalParagraphStyle&gt;&gt;
&lt;ParaStyle:NormalParagraphStyle&gt;
&gt;&lt;TableStart:<xsl:value-of select="count(./tgroup/tbody/row)"/>,<xsl:value-of select="string(./tgroup/@cols)"/>,<xsl:value-of select="count(./tgroup/thead/row)"/>,<xsl:value-of select="count(./tgroup/tfoot/row)"/>&lt;tCellDefaultCellType:Text&gt;&gt;&lt;ColStart :&lt;tColAttrWidth:75.9345668452329&gt;&gt;&lt;Col Start:&lt;tColAttrWidth:147.5005&gt;&gt;&lt;ColSta rt:&lt;tColAttrWidth:107.93456684523301&gt;&gt;
</xsl:template>

<xsl:template match="table/thead">
<xsl:if test="count(/table/thead/row)!='0'">
<xsl:for-each select="table/thead/row/entry">

&lt;RowStart:&lt;tRowAttrHeight:60.523913574218746 &gt;&lt;tRowAttrMinRowSize:33.611611111113234&gt;& gt;&gt;&lt;CellStart:1,1&lt;tCellAttrLeftStrokeWei ght:0&gt;&lt;tCellAttrRightStrokeWeight:0&gt;&lt;t CellAttrTopStrokeWeight:0&gt;&lt;tCellAttrBottomSt rokeWeight:0&gt;&gt;&lt;ParaStyle:NormalParagraphS tyle&gt;
<xsl:value-of select="table/tgroup/thead/row/entry[1]"/>&lt;CellEnd:&gt;
</xsl:for-each>
</xsl:if>
</xsl:template>

</xsl:stylesheet>


Can somebody suggest where I am wrong?


Thanks,
Pankaj











__________________
Pankaj
Reply With Quote