<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>5015</bug_id>
          
          <creation_ts>2007-09-05 12:13:08 +0000</creation_ts>
          <short_desc>Need working example for accessing line number in XSL</short_desc>
          <delta_ts>2008-06-25 14:08:08 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>mobileOK Basic checker</product>
          <component>Java Library</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Sean Owen">srowen</reporter>
          <assigned_to name="Roland G">roland</assigned_to>
          <cc>abel.rionda</cc>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>16373</commentid>
    <comment_count>0</comment_count>
    <who name="Sean Owen">srowen</who>
    <bug_when>2007-09-05 12:13:08 +0000</bug_when>
    <thetext>We have infrastructure to obtain line number from the source document via Saxon but so far have only used it in Java code. We need a working XSL-based example for everyone.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>17041</commentid>
    <comment_count>1</comment_count>
    <who name="Roland G">roland</who>
    <bug_when>2007-10-07 09:13:08 +0000</bug_when>
    <thetext>DOMUtils.getNodeLineNumber(Node) in the XSLT returns an error.

The java function is used in the XSLT by:
xmlns:javaLineNumber=&quot;org.w3c.mwi.mobileok.basic.DOMUtils&quot;
...
&lt;xsl:value-of select=&quot;javaLineNumber:getNodeLineNumber(node())&quot;/&gt;
...
returns a:

  Error in call to extension function {public static int
  org.w3c.mwi.mobileok.basic.DOMUtils.getNodeLineNumber(org.w3c.dom.Node)}: Exception in
  extension function java.lang.ClassCastException:
  com.sun.org.apache.xerces.internal.dom.ElementNSImpl cannot be cast to
  net.sf.saxon.dom.NodeOverNodeInfo
Exception in thread &quot;main&quot; org.w3c.mwi.mobileok.basic.TestException: StyleSheetsUseTest
        at org.w3c.mwi.mobileok.basic.AbstractXSLTTestImplementation.runTest(AbstractXSLTTestImplementation.java:31)
        at org.w3c.mwi.mobileok.basic.Tester.runTests(Tester.java:68)
        at org.w3c.mwi.mobileok.basic.Tester.main(Tester.java:145)
Caused by: net.sf.saxon.trans.DynamicError: Error in call to extension function {public static int org.w3c.mwi.mobileok.basic.DOMUtils.getNodeLineNumber(org.w3c.dom.Node)}: Exception in extension function java.lang.ClassCastException: com.sun.org.apache.xerces.internal.dom.ElementNSImpl cannot be cast to net.sf.saxon.dom.NodeOverNodeInfo
        at net.sf.saxon.functions.ExtensionFunctionCall.iterate(ExtensionFunctionCall.java:115)
        at net.sf.saxon.expr.Expression.evaluateItem(Expression.java:265)
        at net.sf.saxon.instruct.SimpleContentConstructor.evaluateItem(SimpleContentConstructor.java:216)
        at net.sf.saxon.instruct.ValueOf.processLeavingTail(ValueOf.java:198)
        at net.sf.saxon.instruct.Instruction.process(Instruction.java:91)
        at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:240)
        at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:365)
        at net.sf.saxon.instruct.Choose.processLeavingTail(Choose.java:347)
        at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:365)
        at net.sf.saxon.instruct.Instruction.process(Instruction.java:91)
        at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:240)
        at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:365)
        at net.sf.saxon.instruct.Template.expand(Template.java:112)
        at net.sf.saxon.instruct.CallTemplate.process(CallTemplate.java:212)
        at net.sf.saxon.instruct.CallTemplate.processLeavingTail(CallTemplate.java:237)
        at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:365)
        at net.sf.saxon.instruct.Template.applyLeavingTail(Template.java:98)
        at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:317)
        at net.sf.saxon.instruct.ApplyTemplates.defaultAction(ApplyTemplates.java:349)
        at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:310)
        at net.sf.saxon.instruct.ApplyTemplates.defaultAction(ApplyTemplates.java:349)
        at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:310)
        at net.sf.saxon.instruct.ApplyTemplates.defaultAction(ApplyTemplates.java:349)
        at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:310)
        at net.sf.saxon.instruct.ApplyTemplates.defaultAction(ApplyTemplates.java:349)
        at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:310)
        at net.sf.saxon.instruct.ApplyTemplates.defaultAction(ApplyTemplates.java:349)
        at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:310)
        at net.sf.saxon.instruct.ApplyTemplates.defaultAction(ApplyTemplates.java:349)
        at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:310)
        at net.sf.saxon.instruct.ApplyTemplates.defaultAction(ApplyTemplates.java:349)
        at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:310)
        at net.sf.saxon.instruct.ApplyTemplates.defaultAction(ApplyTemplates.java:349)
        at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:310)
        at net.sf.saxon.instruct.ApplyTemplates.defaultAction(ApplyTemplates.java:349)
        at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:310)
        at net.sf.saxon.instruct.ApplyTemplates.apply(ApplyTemplates.java:187)
        at net.sf.saxon.instruct.ApplyTemplates.process(ApplyTemplates.java:147)
        at net.sf.saxon.instruct.DocumentInstr.evaluateItem(DocumentInstr.java:243)
        at net.sf.saxon.expr.ExpressionTool.evaluate(ExpressionTool.java:361)
        at net.sf.saxon.expr.LetExpression.eval(LetExpression.java:229)
        at net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:396)
        at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:365)
        at net.sf.saxon.instruct.Instruction.process(Instruction.java:91)
        at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:240)
        at net.sf.saxon.instruct.Template.applyLeavingTail(Template.java:98)
        at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:317)
        at net.sf.saxon.Controller.transformDocument(Controller.java:1705)
        at net.sf.saxon.Controller.transform(Controller.java:1513)
        at org.w3c.mwi.mobileok.basic.AbstractXSLTTestImplementation.runTest(AbstractXSLTTestImplementation.java:26)
        ... 2 more
Caused by: java.lang.ClassCastException: com.sun.org.apache.xerces.internal.dom.ElementNSImpl cannot be cast to net.sf.saxon.dom.NodeOverNodeInfo
        at org.w3c.mwi.mobileok.basic.DOMUtils.getNodeLineNumber(DOMUtils.java:164)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:589)
        at net.sf.saxon.functions.ExtensionFunctionCall.invokeMethod(ExtensionFunctionCall.java:513)
        at net.sf.saxon.functions.ExtensionFunctionCall.call(ExtensionFunctionCall.java:223)
        at net.sf.saxon.functions.ExtensionFunctionCall.iterate(ExtensionFunctionCall.java:111)
        ... 51 more</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>17043</commentid>
    <comment_count>2</comment_count>
    <who name="Roland G">roland</who>
    <bug_when>2007-10-07 09:21:28 +0000</bug_when>
    <thetext>actually there are problems to use DOMUtils.getNodeLineNumber(Node) in the XSLTs as a function.
could you check this problem and reassign me the bug?


</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>