[xslt] BUG: saxon:line-number() fails for external entities
- From: "Steve Cheng" <g3chengs cdf toronto edu>
- To: xslt gnome org
- Subject: [xslt] BUG: saxon:line-number() fails for external entities
- Date: 18 Aug 2004 09:47:58 -0400
The subject says it all really. I would have posted on the bug database,
but I also want to ask a related question (later below).
Test case:
root.xml
========
<!DOCTYPE root [
<!ENTITY entity SYSTEM "entity.xml">
]>
<root>
&entity;
</root>
entity.xml
==========
<element>
</element>
saxon-line-number.xsl
=====================
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:saxon="http://icl.com/saxon"
exclude-result-prefixes="saxon"
version="1.0">
<xsl:output method="text" />
<xsl:template match="*">
<xsl:text>In </xsl:text>
<xsl:value-of select="name()" />
<xsl:text>: </xsl:text>
<xsl:value-of select="saxon:line-number()" />
<xsl:text> </xsl:text>
<xsl:apply-templates />
</xsl:template>
</xsl:stylesheet>
output
======
$ xsltproc -V
Using libxml 20611, libxslt 10108 and libexslt 806
xsltproc was compiled against libxml 20611, libxslt 10108 and libexslt 806
libxslt 10108 was compiled against libxml 20611
libexslt 806 was compiled against libxml 20611
$ xsltproc saxon-line-number.xsl root.xml
In root: 4
In element: 0
expected output
===============
$ xsltproc saxon-line-number.xsl root.xml
In root: 4
In element: 1
Note the "0" in the output. The SAXON docs (and the code comments)
explicitly say that the line number is supposed to be that of the
entity that contains the (context) node.
Looking at the code implementing the saxon:line-number(), it seems
like xmlGetLineNo() is not giving the correct line number --- I don't
know if it is supposed to, the API docs are somewhat vague in this area.
Related question:
I want to also implement saxon:system-id() (for stylesheet diagnostics
to the user). If I try reading node->doc->URL a similar problem occurs
with external entities. Is there a standard way to get the URI of
the entity of a given node?
Thanks for you help,
--
Steve Cheng
鄭君博
docbook2X: <URL:http://docbook2x.sourceforge.net/>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]