sourcefile from jar on win command line

  • Anonymous - 2012-03-16

    I realize this is probably a trivial question: how do I make Saxon read a
    source file that is inside a jar? The issue is: LibreOffice does not work well
    with XSLT filters, and my work around is to directly read the content.xml
    which is inside a LibreOffice document file rather then invoke the
    transformation from inside LibreOffice.

    So I am trying something like:
    java -jar "c:\Users...\saxon9he.jar"
    "jar:file://c:\Users...\myFile.ods!/content.xml" myStyleSheet.xslt

    But to no avail. I get the erro:
    Transformation failed: Source file jar:file:\c:...\myFile\content.xml does not

    I've tried replacing slashes with backslashes, but it seems java takes care of
    this pitfall. What am I doing wrong? I am sure the solution is very simple.

    All the best,

  • Anonymous - 2012-03-16

    Hi everybody,

    I found it: I need to use the -u option and use a single slash after file:.

    java -jar "c:\Users...\saxon9he.jar" -u
    "jar:file:/c:\Users...\myFile.ods!/content.xml" myStyleSheet.xslt

    works. Hope this is helpful for others!


  • Michael Kay

    Michael Kay - 2012-03-16

    I would recommend using forwards slashes rather than backslashes. The
    standards for file scheme URIs are pretty fuzzy, but forwards slash is the
    only path delimiter recognized in the W3C URI specs.

    The "jar" URI scheme, incidentally, is not defined in any standard, but was
    invented by Sun. Because of the exclamation mark, the URIs are technically
    illegal according to the RFC specifications, and therefore according to the
    XSLT spec, and they aren't accepted by the java class, but Saxon
    treats them specially in the interests of user convenience.


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks