This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 5015 - Need working example for accessing line number in XSL
Summary: Need working example for accessing line number in XSL
Status: RESOLVED FIXED
Alias: None
Product: mobileOK Basic checker
Classification: Unclassified
Component: Java Library (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Roland G
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-05 12:13 UTC by Sean Owen
Modified: 2008-06-25 14:08 UTC (History)
1 user (show)

See Also:


Attachments

Description Sean Owen 2007-09-05 12:13:08 UTC
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.
Comment 1 Roland G 2007-10-07 09:13:08 UTC
DOMUtils.getNodeLineNumber(Node) in the XSLT returns an error.

The java function is used in the XSLT by:
xmlns:javaLineNumber="org.w3c.mwi.mobileok.basic.DOMUtils"
...
<xsl:value-of select="javaLineNumber:getNodeLineNumber(node())"/>
...
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 "main" 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
Comment 2 Roland G 2007-10-07 09:21:28 UTC
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?