RE: [xsl] Saxon processing problem...

Subject: RE: [xsl] Saxon processing problem...
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Sun, 30 Mar 2008 05:10:46 +0100
The StackOverflow looks like a (previously unreported) Saxon bug. I'll look
into it. 

Note that product-specific problems should generally be reported on the
appropriate list/forum for that product; in the case of Saxon this is the
saxon-help list or forum which you can find via the saxon project on
sourceforge.

Michael Kay
http://www.saxonica.com/

 

> -----Original Message-----
> From: Robert Wilkins [mailto:wilkins.robert@xxxxxxxxxxx] 
> Sent: 29 March 2008 17:46
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Saxon processing problem...
> 
> 
> 
> 
> All of this should work, did work, but doesn't.  The source 
> document contains an error message table. The stylesheet 
> should simply grab a group of rows from a table, and write 
> the results to a set of result- documents based on a 
> group-size parameter. I am using several other stylesheets 
> that perform similar tasks, and all of them work. This source 
> document is DITA-based; the others are not. Any help would be 
> greatly appreciated.
> 
> Error #1 -
> If use Saxon8 or Saxon9 and try to output to a 
> <result-document> from the command line, I get a 
> java.lang.StackOverflowError. If I use Saxon9B in Eclipse 
> (w/oXygenxml), I get an error that says "[Saxon9B]
> null	Ant_Doc/xsl	mkpreprocerrs.xsl	Unknown	
> 1206732845515	291"
> 
> Error #2
> If I comment the <result-document> tags and use Saxon6.5.5 in 
> Oxygen, the transformations occur, but the title and short 
> description content in the output appear after the 
> declaration, like this :
> 
> 
> <?xml version="1.0" encoding="utf-8"?>Source document 
> titleShort decription content <!DOCTYPE reference
>     PUBLIC "-//OASIS//DTD DITA Reference//EN" 
> "Reference.dtd"> <reference id="allprocerrs1-ref">
>      <title id="allprocerrs1-title">Messages 2601 through 2621</title>
> 
> Source Document
> 
> <?xml version="1.0"?>
> <!DOCTYPE reference PUBLIC "-//OASIS//DTD DITA Reference//EN"  
> "reference.dtd">
>     <reference id="allpreprocerrs_ref">
>        <title>Source document title</title> <shortdesc> Short 
> decription content/shortdesc>
>        <refbody>
>           <table id="allpperrs_tbl">
>              <tgroup cols="5">
>                 <colspec colnum="1" colname="col1" colwidth="1*"/>
>                 <colspec colnum="2" colname="col2" colwidth="1*"/>
>                 <colspec colnum="3" colname="col3" colwidth="3*"/>
>                 <colspec colnum="4" colname="col4" colwidth="3*"/>
>                 <colspec colnum="5" colname="col5" colwidth="1*"/>
>                 <thead>
>                    <row>
>                       <entry colname="col1" 
> align="center">Type</entry>
>                       <entry colname="col2" align="center">Number</ 
> entry>
>                       <entry colname="col3" align="center">Message</ 
> entry>
>                       <entry colname="col4" 
> align="center">Possible Cause</entry>
>                       <entry colname="col5" 
> align="center">UltraLite</ 
> entry>
>                    </row>
>                 </thead>
>                 <tbody>
>                    <row>
>                       <entry colname="col1" align="left">
>                          <p>Error</p>
>                       </entry>
>                       <entry colname="col2">
>                          <p>2601</p>
>                       </entry>
>                       <entry colname="col3" align="left">
>                          <p>subscript value %1 too large</p>
>                       </entry>
>                       <entry colname="col4">
>                          <p>You have attempted to index a 
> host variable that is an array with a value too large for the 
> array.</p>
>                       </entry>
>                       <entry colname="col5">
>                          <p>False</p>
>                       </entry>
>                    </row>
>                    <row>
>                       <entry colname="col1" align="left">
>                          <p>Error</p>
>                       </entry>
>                       <entry colname="col2">
>                          <p>2602</p>
>                       </entry>
>                       <entry colname="col3" align="left">
>                          <p>combined pointer and arrays not 
> supported for host types</p>
>                       </entry>
>                       <entry colname="col4">
>                          <p>You have used an array of 
> pointers as a host variable. This is not legal.</p>
>                       </entry>
>                       <entry colname="col5">
>                          <p>False</p>
>                       </entry>
>                    </row>
>                    <row>
>                       <entry colname="col1" align="left">
>                          <p>Error</p>
>                       </entry>
>                       <entry colname="col2">
>                          <p>2603</p>
>                       </entry>
>                       <entry colname="col3" align="left">
>                          <p>combined pointer and arrays not 
> supported for host types</p>
>                       </entry>
>                       <entry colname="col4">
>                          <p>You have attempted to declare a 
> host variable as an array of character arrays. This is not a 
> legal host variable type</p>
>                       </entry>
>                       <entry colname="col5">
>                          <p>False</p>
>                       </entry>
>                    </row>
>                    <row>
>                       <entry colname="col1" align="left">
>                          <p>Error</p>
>                       </entry>
>                       <entry colname="col2">
>                          <p>2604</p>
>                       </entry>
>                       <entry colname="col3" align="left">
>                          <p>VARCHAR type must have a length</p>
>                       </entry>
>                       <entry colname="col4">
>                          <p>You have attempted to declare a 
> VARCHAR or BINARY host variable using the DECL_VARCHAR or 
> DECL_BINARY macro but have not specified
>                             a size for the array.
>                          </p>
>                       </entry>
>                       <entry colname="col5">
>                          <p>False</p>
>                       </entry>
>                    </row>
>                    <row>
>                       <entry colname="col1" align="left">
>                          <p>Error</p>
>                       </entry>
>                       <entry colname="col2">
>                          <p>2605</p>
>                       </entry>
>                       <entry colname="col3" align="left">
>                          <p>arrays of VARCHAR not supported</p>
>                       </entry>
>                       <entry colname="col4">
>                          <p>You have attempted to declare a 
> host variable as an array of VARCHAR or BINARY. This is not a 
> legal host variable type.</p>
>                       </entry>
>                       <entry colname="col5">
>                          <p>False</p>
>                       </entry>
>                    </row>
>                    <row>
>                       <entry colname="col1" align="left">
>                          <p>Error</p>
>                       </entry>
>                       <entry colname="col2">
>                          <p>2606</p>
>                       </entry>
>                       <entry colname="col3" align="left">
>                          <p>VARCHAR host variables cannot be 
> pointers</p>
>                       </entry>
>                       <entry colname="col4">
>                          <p>You have attempted to declare a 
> host variable as a pointer to a VARCHAR or BINARY. This is 
> not a legal host variable type.</p>
>                       </entry>
>                       <entry colname="col5">
>                          <p>False</p>
>                       </entry>
>                    </row>
>                 </tbody>
>              </tgroup>
>           </table>
>        </refbody>
>     </reference>
> 
> Stylesheet
> 
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";  
> version="2.0">
> 
> 	<xsl:output method="text"/>
> 	<xsl:output method="xml"
> 		doctype-public="-//OASIS//DTD DITA Composite//EN"
> 		doctype-system="reference.dtd"
> 		indent="yes"
> 		name="xml"/>
> 		
> 	<xsl:strip-space elements="*"/>
> 	<xsl:param name="grp-size" select="number(20)"/>
> 
> 	<xsl:template match="//table">
> 		<xsl:apply-templates mode="stategroup" 
> select="//tbody/row[position
> () mod $grp-size=1]"/>
> 	</xsl:template>
> 
> 	<xsl:template match="//tbody/row" mode="stategroup">
> 	 <xsl:variable name="num">
> 			<xsl:number count="row[position() mod 
> $grp-size=1]"/>
> 	</xsl:variable>
> 		 <xsl:variable name="filename" 
> select="concat('output/preprocerrs/
> preprocerr',$num)"/>
> 		<xsl:result-document href="{$filename}" format="xml">
> 		
> 			<xsl:variable name ="ref-id" 
> select="concat('preproc', $num,'- ref' )"/>
> 			<xsl:variable name ="ttl-id" 
> select="concat('preproc', $num,'- ttl' )"/>
> 			<xsl:variable name ="tbl-id" 
> select="concat('preproc', $num,'- tbl' )"/>
> 
> 				<reference id="{$ref-id}">
> 					<title 
> id="{$ttl-id}">Preprocessing Errors
> 						<xsl:variable 
> name="start" select="./entry[@colname='col2']"/>
> 						<xsl:value-of 
> select="$start[position() mod $grp-size=1]"/> through
> 						
> <xsl:apply-templates mode="varstate" select=". | following-
> sibling::row[position() &lt; $grp-size]">
> 						</xsl:apply-templates>
> 					</title>
> 					<shortdesc></shortdesc>
> 					<refbody>
> 						<table id="{$ttl-id}">
> 						<tgroup cols="4">
> 							
> <colspec column="1" colname="col1" colwidth="1*"/>
> 							
> <colspec column="2" colname="col2" colwidth="2.25*"/>
> 							
> <colspec column="3" colname="col3" colwidth="1*"/>
> 							
> <colspec column="4" colname="col5" colwidth="2.25*"/>
> 						<thead>
> 							<row>
> 								
> <entry colname="col1" align="center">Error Code</entry>
> 								
> <entry colname="col1" align="center">Type</entry>
> 								
> <entry colname="col1" align="center">Message</entry>
> 								
> <entry colname="col1" align="center">Possible Cause</entry>
> 							</row>
> 						</thead>
>              				<tbody>
>              					
> <xsl:apply-templates mode="stateitem" select=". |
> following-sibling::row[position() &lt; $grp-size]">
>              					</xsl:apply-templates>
>              				</tbody>
> 					</tgroup>
> 				</table>
> 				</refbody>
> 			</reference>
> 		</xsl:result-document>
> 	</xsl:template>
> 	
> 	
> 	<xsl:template match="//row" mode="stateitem">
> 		<xsl:variable name="msg-type" 
> select="entry[@colname='col1']"/>
> 		<xsl:variable name="errnum" 
> select="entry[@colname='col2']"/>
> 		<xsl:variable name="errmsg" 
> select="entry[@colname='col3']"/>
> 		<xsl:variable name="poss-cause" 
> select="entry[@colname='col4']"/>
> 		
> 		<row>
> 
> 			<entry colname="col1" align="left" valign="top">
> 				<xsl:value-of select="$msg-type"/>
> 			</entry>
> 			<entry colname="col2" align="left" valign="top">
> 				<xsl:value-of select="$errnum"/>
> 			</entry>
> 				<entry colname="col3" 
> align="left" valign="top">
> 				<xsl:value-of select="$errmsg"/>
> 				</entry>
> 			<entry colname="col4" align="left" valign="top">
> 				<xsl:value-of select="$poss-cause"/>
> 			</entry>
> 		</row>
> 	</xsl:template>
> 	
> 	
> 	<xsl:template match="//row" mode="varstate">
> 		<xsl:choose>
> 			<xsl:when test="position()=last()">
> 				<xsl:value-of 
> select="entry[@colname='col2']"/>
> 			</xsl:when>
> 		</xsl:choose>
> 	</xsl:template>
> 	
> 	
> </xsl:stylesheet>

Current Thread