Menu

help with document function

Help
Anonymous
2011-11-30
2012-10-08
  • Anonymous

    Anonymous - 2011-11-30

    Hi, I'm very new to saxon.

    I am creating a Table of Contents using a listing of XML filenames, and the
    XSLT document() function.

    I know the XSLT works because I can view the XML file in the browser and get
    the desired results, however, when I run Saxon from the command line, I get an
    error message:

    "Document has been marked not available"

    Here is the command i'm using:
    java -jar saxon9he.jar -a toc.xml -o:toc.html

    The error is point to the line in the XSLT where I am using the document()
    function.

     
  • Michael Kay

    Michael Kay - 2011-11-30

    Intriguing - this isn't a message we see very often. The cases where it can
    legitimately occur are, for example, where you call the function doc-
    available() and get false, and then later use the same URI to call document()
    - even though the situation has changed and the document might now exist,
    Saxon is obliged to report that it doesn't exist because its answers must be
    consistent. But you imply that this stylesheet works under XSLT 1.0, so that
    seems unlikely.

    The thing that you are doing that's unusual is the use of the -a option, so
    that's where my suspicions would lie. But I would need to see more detail of
    what you are doing to diagnose the problem.

     
  • Anonymous

    Anonymous - 2011-12-05

    Well i'm not using any functions native to saxon. The document function I'm
    using is the XSLT one. It's the same XSLT i can use for the browser.

    Do I need to specify the URI resolver with the -r switch? Or is there a
    default one in use if not declared?
    Would it make a difference if saxon was not being executed from my C drive?

    I have tried using saxon without the -a switch and declaring the same
    stylesheet but still get the same result and error... "Document has been
    marked not available"

     
  • Michael Kay

    Michael Kay - 2011-12-05

    Thanks for the information. Could you please put together a repro: that is,
    source document, stylesheet, and any other resources needed to reproduce the
    problem. Thanks. You can mail it privately if you don't want the world to see
    it - use mike at saxonica dot com.

     
  • Anonymous

    Anonymous - 2011-12-07

    Turns out i was wrong the whole time. The file did not exist. I misread the
    filepath. It was reading it as a relative path from the style sheet rather
    than the XML file.

    Is there any way to make it relative to the XML file instead of the XSL file?

     
  • Michael Kay

    Michael Kay - 2011-12-07

    document('abc.xml', /)

    will resolve abc.xml relative to the base-uri of '/', which will normally be
    the source document.