W3C home > Mailing lists > Public > public-mobileok-checker@w3.org > July 2007

Re: line number problem

From: Roland Gülle <roland@7val.com>
Date: Fri, 13 Jul 2007 07:59:52 +0200
Message-Id: <68DC3122-46E6-494D-A100-44892173ECFA@7val.com>
Cc: "Laura Holmes" <holmes@google.com>, public-mobileok-checker <public-mobileok-checker@w3.org>
To: Sean Owen <srowen@google.com>

> Good point. I suppose I had imagined that the XSLT would operate on a
> DOM that we manually build up in Java, and includes the real, original
> DOM that was parsed from the source document including line number
> info -- not a copy. Then the line-number-related methods should still
> work.
>
> But indeed, none of this works if you parse a moki document from
> scratch in an XSLT since the original line number info is lost. Which
> partially shoots its raison d'etre in the foot.
>
> Better ideas? Unless what I sketched out above works, we're getting
> more fenced in by using XSLT + moki by the day and think we need to
> think hard about what this approach is gaining versus costing before
> we go further.
I just tested some ideas, here my result:

Some ideas with rebuilding a Nodeset from a string with EXSLT don't  
work:
<xsl:for-each select="exsl:node-set($originalDocAsString)//xpath">
  <xsl:value-of select="saxon:line-number(.)" xmlns:saxon="http:// 
saxon.sf.net/"/>
</xsl:for-each>

But using the document function to reparse a document, works:
<xsl:for-each select="document('originalDocAsFileName)//xpath">
  <xsl:value-of select="saxon:line-number(.)" xmlns:saxon="http:// 
saxon.sf.net/"/>
</xsl:for-each>

It is possible, to access to the original (unparsed) doc with the  
document function?

If so, and the reference to this doc is in the moki document, there  
is a solution:
when reporting a line number:
* call a template with the context you want to report
* this template:
   * gets the original document reference
   * generates the 'html doc xpath' from the current xpath
   * gets the line number with the original doc ref and the generated  
xpath
   * returns the line number

Cheers,
  Roland
Received on Friday, 13 July 2007 13:44:24 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:13:03 GMT