0

I referred [stackoverflow][1]before posting this issue , as getting same issue I hope to ask from you all..

I have a XSLT transformation for creating four outputs using xsl:result-document when I run this using oxygen tool it is created required output.But I want to implement this from java . Already saxon methods have implemented from java. Saxon-HE:9.7.0-14 version XSLT version :2

Example XSLT for one file:

<xsl:template match="/" mode="aa">
        <xsl:param name="book-name" tunnel="yes"/>

        <xsl:result-document href="{$book-name}.opf"
                             doctype-public="+//ISBN 0-9673008-1-9//DTD OEB 1.2 Package//EN"
                             doctype-system="http://openebook.org/dtds/oeb-1.2/oebpkg12.dtd"
                             indent="yes">

            <xsl:apply-templates mode="#current"/>
        </xsl:result-document>
    </xsl:template>

I have no idea why is this not working on Java though this is working on running pure transformation.. Do I need to add external jar for this. And this is not giving me any error or output.

Note: When I added xsl:comment or another tag it is working on Java and I am getting that output correctly.

  • XSLT for creating one file

        <xsl:call-template name="validate-source-book"/>
    
        <xsl:variable name="pre-processed">
            <xsl:apply-templates mode="pre-processing"/>
        </xsl:variable>
    
        <xsl:variable name="structured">
            <xsl:apply-templates select="$pre-processed" mode="structuring"/>
        </xsl:variable>
    
        <xsl:call-template name="generate-output-files">
            <xsl:with-param name="book-name" select="$book-name" tunnel="yes"/>
            <xsl:with-param name="structured-document" select="$structured"/>
        </xsl:call-template>
    </xsl:template>
    

        <xsl:result-document href="{$book-name}.opf"
                             doctype-public="+//ISBN 0-9673008-1-9//DTD OEB 1.2 Package//EN"
                             doctype-system="http://openebook.org/dtds/oeb-1.2/oebpkg12.dtd"
                             indent="yes">
    
            <xsl:apply-templates mode="#current"/>
        </xsl:result-document>
    </xsl:template>
    

Thanks in advance..!

user2490093
  • 69
  • 10
  • Consider to add minimal but complete sample of Java and XSLT code and XML input sample to allow us to reproduce the issue. You say you don't get any error or output, perhaps the files are created in a directory different from the one you are looking for? – Martin Honnen Jul 18 '17 at 10:53
  • I am using daisy core as xslt and there is a huge jar project as Java .Yes I also thought so and gave different file location for creating these files then it gave me "dirName" is directory error.. So I thought we cant generate multiple files from saxon processor. (I have no idea about it)..And I have question that why only xsl:result-document is not working? – user2490093 Jul 18 '17 at 11:03
  • Well, as I said, make a minimal example trying to use Saxon 9 in your environment, then take it from there. If you can't solve it, the post that minimal but complete example here, Java, XSLT, XML. So far we can't tell whether you really use Saxon 9 or perhaps in your server installation Xalan interferes. If you have something that causes an error, then again, to allow us to help solving that, post minimal but complete samples and the exact error message allowing others to reproduce the problem. – Martin Honnen Jul 18 '17 at 11:40
  • @MartinHonnen please pardon me... Could you please brief me Xalan interferes installation..Our project build from gradle , I just added xalan:2.7.1 to project..Is it ok? – user2490093 Jul 18 '17 at 11:59
  • If you want to use Saxon and XSLT 2.0 then you should make sure that Xalan does not interfere. So adding Xalan to your project does not make any sense at all. I am afraid I can't help with that stuff without any information, start with http://saxonica.com/html/documentation9.7/about/installationjava/ and then with http://saxonica.com/html/documentation9.7/using-xsl/embedding/, in particular, if you use JAXP, then see http://saxonica.com/html/documentation9.7/using-xsl/embedding/jaxp-transformation.html – Martin Honnen Jul 18 '17 at 12:34

0 Answers0