Re: [xsl] xslt processing order

Subject: Re: [xsl] xslt processing order
From: "Manfred Staudinger" <manfred.staudinger@xxxxxxxxx>
Date: Tue, 15 Apr 2008 22:40:15 +0200
Hi Ilya,

>  Error on line 369 column 28 of
>  file:/C:/cygwin/home/ilya/srcs/private/xml/first_stage.xsl:
>   SXXP0003: Error reported by XML parser: The entity
>  "usb_spec_ref_name" was referenced, but
>   not declared.
Before XSLT processing can start, both the input XML and the
stylesheet have to be processed by the XML parser (get "parsed* into a
node-tree). It seems the parser cannot find the line
>  <!ENTITY usb_spec_ref_name "USB Specification">
in first_stage.xsl, where it has found the entity. If you would
include it (or preemble.ent) at the beginning of your XSLT it would
parse.

>  It seems like the error i got is some sanity validation before
>  the actual transformation is started since it's happened very fast and
>  the template is used at the end of quite big document.
Correct, the XSLT gets parsed first. The XSLT processor acts on the
node-tree, so it has done nothing up to that point.

Regards,

Manfred

On 15/04/2008, Ilya Lifshits <chehlo@xxxxxxxxx> wrote:
> Hi,
>
>  I have a problem using entities in named template. To fix the problem
>  i want to understand how processing of xsl is working.
>  In my situation i have  one xml file that include preamble.ent with
>  some entities defined in there.  I'm, processing this file this some
>  xsl with number of templates to another xml.
>  Then i try using any of the entities in xml file it's work as
>  expected, but if i use any entity in the template i got the following
>  error:
>
>  Error on line 369 column 28 of
>  file:/C:/cygwin/home/ilya/srcs/private/xml/first_stage.xsl:
>   SXXP0003: Error reported by XML parser: The entity
>  "usb_spec_ref_name" was referenced, but
>   not declared.
>
>  I'm using saxon 9. and xslt 2.0.
>
>  Command line:
>
>  java -jar c:/utils/saxon/java/saxon9.jar  -s:ut_man.xml -xi:on
>  -xsl:first_stage.xsl -o:out/ut_man_docbook.xml
>
>  the snipsets of the relevant part of the files are the following :
>  preemble.ent
>  ------------------
>  <!ENTITY usb_spec_ref_name "USB Specification">
>
>  ut_man.xml
>  -----------------
>  <listitem>
>                 <j_desc_verify/>
>  <listitem>
>
>
>  first_stage.xsl
>  --------------------
>
>  <xsl:template match="j_desc_verify">
>     <xsl:param name="param" select="Verify"/>
>     <xsl:value-of select="$param"/> that the returned descriptor
>  compiles with the
>         &usb_spec_ref_name;
>  </xsl:template>
>
>  Just a solution will be good, but the explanation why it's happened
>  will be much better :) It will be nice to understand the
>  transformation process at the level i understand compilation stages of
>  C code. It seems like the error i got is some sanity validation before
>  the actual transformation is started since it's happened very fast and
>  the template is used at the end of quite big document.
>
>  Regards Ilya.

Current Thread