0

I am new to Java. I have a similar scenario as [Catch output stream of xsl result-document but I am not understanding what to pass as href and base parameter..

My XSLT (result-document) as follows:

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

        <xsl:result-document href="{$book-name}.xml"
            doctype-public=" test"
            doctype-system="test.dtd">
            <xsl:apply-templates/>
        </xsl:result-document>
    </xsl:template>

Another:

<xsl:result-document href="{$book-name}.opf"
                             doctype-public=""
                             doctype-system=""
                             indent="yes">

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

Parameter book-name is getting as :

<xsl:template match="document-node()">
        <xsl:variable name="book-name" select="tps:get-file-name(document-uri(/))"/>

Can you please explain me with this result-documents?

Thanks in advance.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
user2490093
  • 69
  • 10

1 Answers1

0

OutputURIResolver is a callback: that means you supply the implementation of the resolve() method, and Saxon calls your implementation. So you don't need to worry about what to pass as the base and href arguments, because you don't call the method, Saxon does. It will typically supply the href argument as the (expanded) value of the href attribute of your call to xsl:result-document, and the base value will be the "base output URI", which defaults to the file nominated as the principal output of the transformation (-o option on the command line).

Michael Kay
  • 156,231
  • 11
  • 92
  • 164
  • Sir can we give a folder path or custom location as base when I am not using command line argument? And what I understood is, if we extracted xslt zip package(according to my scenario) OutputURIResolver is this getting href value . – user2490093 Jul 25 '17 at 18:16
  • If you use the s9api interface you can set the base output URI using `XsltTransformer.setBaseOutputURI()`. There's no equivalent in JAXP because JAXP was designed for XSLT 1.0. – Michael Kay Jul 26 '17 at 10:16