xsl-list
[Top] [All Lists]

[xsl] Re: OutputURIResolver Cause: net.sf.saxon.trans

2012-02-27 09:56:38
Hi there,
when running the following snippet of XSL stylesheet against Saxon 9,
I encountered with this error:

I   [xslt] : Fatal Error! Exception thrown by OutputURIResolver Cause:
net.sf.saxon.trans.XPathException: Resolved URL is malformed

////XSLT written in Version 2.0///////////////////

 <xsl:result-document href="{$OUTPUTDIR}/{$title}.xml">
                
          <!--xsl:choose>
            <xsl:when test="contains($outputformat, 'Impleo')">
              <xsl:choose>
                <xsl:when test="$multilingual = 'yes'">
                  <xsl:apply-templates
select="document(concat('file:///', $WORKDIR, '\temp\',
substring(@href, 4)))" mode="copy"/>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:apply-templates select="document(@href)" mode="copy"/>
                </xsl:otherwise>
              </xsl:choose>
            </xsl:when>
            <xsl:otherwise-->
              <!--xsl:apply-templates select="document(@href)"
mode="copy-and-modify"/semc0222-->
            <xsl:variable name="uri" select="concat('file:///',
$WORKDIR, '\temp\', substring(@href, 4))" />
            <xsl:message select="$uri"/>
            <xsl:apply-templates select="document($uri)" mode="copy"/>

            <!--/xsl:otherwise>
          </xsl:choose-->
        </xsl:result-document>

//////////////////////////////////////////////////////////////

Input :
  <?xml version="1.0" encoding="utf-8" ?>
  <?workdir 
/D:\InfoShare\Data\PublishingService\Data\DataExports\GUID-078DE499-06E8-4EDC-964F-52CF0621CDB4.20110825082156145\1\en\workset\temp?>
  <?path2project ?>
  <?ish ishref="GUID-F2DF918A-90C1-4775-B43A-62C035A12E9D" version="3"
lang="en"?>
- <map title="Default Title"
id="GUID-F2DF918A-90C1-4775-B43A-62C035A12E9D" chg="undef"
ishlabelxpath="@title" DTDVersion="V1.1.3" domains="(map mapgroup-d)"
class="- map/map"
xtrf="D:\InfoShare\Data\PublishingService\Data\DataExports\GUID-078DE499-06E8-4EDC-964F-52CF0621CDB4.20110825082156145\1\en\workset\GUID-F2DF918A-90C1-4775-B43A-62C035A12E9D.ditamap"
xtrc="map:1">

<!-- Start of embed for GUID-A48859DF-43CA-4C24-A2C3-19525D7D8B44.xml
  -->
- <reference id="GUID-A48859DF-43CA-4C24-A2C3-19525D7D8B44"
domains="%included-domains;" ishlabelxpath="./title" class="-
topic/topic reference/reference"
xtrf="D:\InfoShare\Data\PublishingService\Data\DataExports\GUID-078DE499-06E8-4EDC-964F-52CF0621CDB4.20110825082156145\1\en\workset\GUID-A48859DF-43CA-4C24-A2C3-19525D7D8B44.xml"
xtrc="reference:1" refclass="- map/topicref">
  <title id="GUID-2DABE0AB-3533-4922-B945-546FBECA27FE"
ishlabelxpath="./title | @alt | @href | @conref | @id"
ishlinkxpath="@conref | @href[contains(parent::*/@class,' topic/image
') and not(parent::*/@conref)]" class="- topic/title"
xtrf="D:\InfoShare\Data\PublishingService\Data\DataExports\GUID-078DE499-06E8-4EDC-964F-52CF0621CDB4.20110825082156145\1\en\workset\GUID-A48859DF-43CA-4C24-A2C3-19525D7D8B44.xml"
xtrc="title:1" />
- <refbody ishlabelxpath="./title | @alt | @href | @conref | @id"
ishlinkxpath="@conref | @href[contains(parent::*/@class,' topic/image
') and not(parent::*/@conref)]" class="- topic/body reference/refbody"
xtrf="D:\InfoShare\Data\PublishingService\Data\DataExports\GUID-078DE499-06E8-4EDC-964F-52CF0621CDB4.20110825082156145\1\en\workset\GUID-A48859DF-43CA-4C24-A2C3-19525D7D8B44.xml"
xtrc="refbody:1">
- <section id="GUID-52FC6164-8517-4E8D-8C6A-5D777DF58ECF"
ishlabelxpath="./title | @alt | @href | @conref | @id"
ishlinkxpath="@conref | @href[contains(parent::*/@class,' topic/image
') and not(parent::*/@conref)]" class="- topic/section"
xtrf="D:\InfoShare\Data\PublishingService\Data\DataExports\GUID-078DE499-06E8-4EDC-964F-52CF0621CDB4.20110825082156145\1\en\workset\GUID-A48859DF-43CA-4C24-A2C3-19525D7D8B44.xml"
xtrc="section:1">
  <p ishlabelxpath="./title | @alt | @href | @conref | @id"
ishlinkxpath="@conref | @href[contains(parent::*/@class,' topic/image
') and not(parent::*/@conref)]" class="- topic/p"
xtrf="D:\InfoShare\Data\PublishingService\Data\DataExports\GUID-078DE499-06E8-4EDC-964F-52CF0621CDB4.20110825082156145\1\en\workset\GUID-A48859DF-43CA-4C24-A2C3-19525D7D8B44.xml"
xtrc="p:1">We fulfil the requirements of the R&TTE Directive
(1999/5/EC).</p>
  </section>
  </refbody>
  </reference>
  </map>

Origionally, the full stylesheet including above snippet was written
in XSLT 1.0, as follows:

<?xml version="1.0"?>
<!-- Copy, transform, and rename all used XML files to a temporary
folder to be transformed into HTML -->
<!-- Input: DITA map -->
<!-- Output: Copies of all XML files actually being used, not
belonging to chunk -->
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>;

  <xsl:output method="xml" encoding="utf-8"/>

  <xsl:include href="../common/infoshare.jobticket.xsl"/>
  <xsl:include href="../common/infoshare.params.xsl"/>
  <xsl:include href="transform-titles.xsl"/>

  <xsl:param name="OUTPUTDIR"/>

  <xsl:template match="/*">
    <xsl:choose>
      <xsl:when test="contains($outputformat, 'Impleo') and
($multilingual = 'yes')">
        <xsl:apply-templates select="child::*[contains(@class,'
map/topicref ')][1]/descendant::*[contains(@class,' map/topicref
')]"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:apply-templates select="descendant::*[contains(@class,'
map/topicref ')]"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="*[contains(@class,' map/topicref ')]">
    <xsl:choose>
      <xsl:when test="ancestor::*[@chunk='yes'] and not(self::*[@chunk='yes'])">
        <xsl:message>clean-up.xsl: Not copied the file "<xsl:value-of
select="@navtitle"/>" due to chunking</xsl:message>
      </xsl:when>
      <xsl:when test="contains(@href,
'GUID-9B08C5DF-5C36-41C4-90B0-27B79F005469')">
        <xsl:message>clean-up.xsl: Not copied the file
"Z-Admin-Publication Extended"</xsl:message>
      </xsl:when>
      <xsl:when test="contains(@href,
'GUID-8B987545-B343-4B40-B852-2CEFEBC4FE9E')">
        <xsl:message>clean-up.xsl: Not copied the file
"Z-Admin-Publication Basic"</xsl:message>
      </xsl:when>
      <xsl:when test="contains(@href,
'GUID-C3FB8F77-8818-4E16-989C-A092C9F1332C')">
        <xsl:message>clean-up.xsl: Not copied the file "Function name
in review pdf"</xsl:message>
      </xsl:when>
      <xsl:when test="contains(@href,
'GUID-DDB0F1C0-9B28-43FB-9B79-E9836299D2CE')">
        <xsl:message>clean-up.xsl: Not copied the SAR cover topic</xsl:message>
      </xsl:when>
      <xsl:when test="contains(@outputclass, 'remove-from-output')">
        <xsl:message>clean-up.xsl: Not copied the file "<xsl:value-of
select="@href"/>" with @outputclass="remove-from-output"</xsl:message>
      </xsl:when>
      <xsl:when test="contains(@outputclass, 'cover')">
        <xsl:message>clean-up.xsl: Not copied the file "<xsl:value-of
select="@href"/>" with @outputclass="cover"</xsl:message>
      </xsl:when>
      <xsl:when test="contains(@id,
'GUID-1535CC3F-3B17-4D8B-9452-D2FDD988577A')">
        <xsl:message>clean-up.xsl: Not copied the file "<xsl:value-of
select="@href"/>" with Polish CE image</xsl:message>
      </xsl:when>
      <xsl:otherwise>
        <xsl:variable name="title">
          <xsl:choose>
            <xsl:when test="contains($outputformat, 'Impleo')">
              <xsl:choose>
                <xsl:when test="@type = 'SZ-Content-item-Snipplet'">
                  <xsl:text>ContentItems-Snipplettes\</xsl:text>
                </xsl:when>
                <xsl:when test="@type = 'SZ-Snippet'">
                  <xsl:text>Snippets\</xsl:text>
                </xsl:when>
                <xsl:when test="@type = 'SZ-Topic-page'">
                  <xsl:text>Topicpages\</xsl:text>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:text>NoType\</xsl:text>
                </xsl:otherwise>
              </xsl:choose>
              <xsl:choose>
                <xsl:when test="$multilingual = 'yes'">
                  <!-- The href attribute values start with language
codes in multilingual maps -->
                  <xsl:value-of
select="substring(substring-before(@href, '.xml'), 4)"/>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:value-of select="substring-before(@href, '.xml')"/>
                </xsl:otherwise>
              </xsl:choose>
            </xsl:when>
            <xsl:otherwise>
              <xsl:call-template name="transform-title">
                <xsl:with-param name="xtrc" select="@xtrc"/>
              </xsl:call-template>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:variable>
        <xsl:document href="{$OUTPUTDIR}\{$title}.xml">
          <xsl:choose>
            <xsl:when test="contains($outputformat, 'Impleo')">
              <xsl:choose>
                <xsl:when test="$multilingual = 'yes'">
                  <xsl:apply-templates
select="document(concat('file:///', $WORKDIR, '\temp\',
substring(@href, 4)))" mode="copy"/>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:apply-templates select="document(@href)" mode="copy"/>
                </xsl:otherwise>
              </xsl:choose>
            </xsl:when>
            <xsl:otherwise>
              <xsl:apply-templates select="document(@href)"
mode="copy-and-modify"/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:document>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="node() | @*" mode="copy">
    <xsl:copy>
      <xsl:apply-templates select="@* | node()" mode="copy"/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="node() | @*" mode="copy-and-modify">
    <xsl:copy>
      <xsl:apply-templates select="@* | node()" mode="copy-and-modify"/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="*[contains(@class, ' topic/topic ')]/@xtrf"
mode="copy-and-modify">
    <xsl:attribute name="xtrf">
      <xsl:call-template name="transform-title">
        <xsl:with-param name="xtrc" select="//*[contains(@class,'
topic/linkpool ')]/@xtrc"/>
      </xsl:call-template>
      <xsl:text>.xml</xsl:text>
    </xsl:attribute>
  </xsl:template>

  <xsl:template match="*[contains(@class, ' topic/xref ') and
(@format='dita' or not(@format))]/@xtrf" mode="copy-and-modify">
    <xsl:attribute name="xtrf">
      <xsl:call-template name="transform-title">
        <xsl:with-param name="xtrc" select="//*[contains(@class,'
topic/linkpool ')]/@xtrc"/>
      </xsl:call-template>
      <xsl:text>.xml</xsl:text>
    </xsl:attribute>
  </xsl:template>

</xsl:stylesheet>



I would grealty appreciate if anyone could suggest how to change the
XSL:document instruction to a XSL 2.0 compliant XSL:result-document
insruction.

Cheers,

2012/2/21, team wise <dfanster(_at_)gmail(_dot_)com>:
Hi the list members,
Can anyone give me some insights to troubleshoot the problem as indicated
below?

When compiling a set of XSLT version 1.0/1.1 style sheets using SAXON
9, I encountered with error as follows :
Exception thrown by OutputURIResolver Cause:: Resolved URL is malformed

Before which a number of other errors had been surpressed and one of
which in question is explained below:

Below reveals an extracted version of a full log of the latest Ant
Build failure:
Processing started...
Initialize log directory and file name...
Validate and init input arguments...
[echo] *********************************************************
[echo] * basedir = D:\InfoShare\App\Utilities\DITA-OT\SEMC_InfoShare
[echo] * dita.dir = D:\InfoShare\App\Utilities\DITA-OT\SEMC_InfoShare
[echo] * input =
D:\InfoShare\Data\PublishingService\Data\DataExports\GUID-75CD4383-F94E-49AA-8182-9776535F8522.20120214202004701\1\en\workset/GUID-C9CA7357-CBA3-43B3-A4B2-B977AD1B7D1E.ditamap
[echo] * transtype = mobilewebguidenxt
[echo] * tempdir =
D:\InfoShare\Data\PublishingService\Data\DataExports\GUID-75CD4383-F94E-49AA-8182-9776535F8522.20120214202004701\1\en\workset/temp
[echo] * outputdir =
D:\InfoShare\Data\PublishingService\Data\DataExports\GUID-75CD4383-F94E-49AA-8182-9776535F8522.20120214202004701\1\en\out
[echo] * extname = .xml
[echo] * clean.temp = no
[echo] * xslt.parser = SAXON
[echo] * HTMLHelpCompiler = ${HTMLHelpCompiler}
[echo] * pdf.formatter = ah
[echo] *********************************************************
Preprocessing started...
Clean temp directory...
GenMapAndTopicListModule.execute(): Starting...
[pipeline] Using XERCES.
[pipeline] Using Xerces grammar pool for DTD and schema caching.
GenMapAndTopicListModule.execute(): Execution time: 2.61 seconds
Generate file list...
Copy necessary files needed for the computer web output...
DebugAndFilterModule.execute(): Starting...
[pipeline] Using Xerces grammar pool for DTD and schema caching.
[pipeline] Using Xerces grammar pool for DTD and schema caching.
DebugAndFilterModule.execute(): Handling file
GUID-54F20824-43B5-4CE1-8EA2-400F1CB13716.xml...
Execution time: 1.188 seconds
Debug and filter input files...
Move metadata entries...
Resolve conref push...
Resolve conref in input files...
[xslt] Loading stylesheet
D:\InfoShare\App\Utilities\DITA-OT\SEMC_InfoShare\xsl\preprocess\conref.xsl
[xslt]
D:\InfoShare\App\Utilities\DITA-OT\SEMC_InfoShare\xsl\InfoShare\xslhtml\ditamap-transformation.xsl:36:
Error! java.io.FileNotFoundException:
D:\InfoShare\Data\PublishingService\Data\DataExports\GUID-75CD4383-F94E-49AA-8182-9776535F8522.20120214202004701\1\en\workset\temp\GUID-30956BCB-576E-4180-9CE4-044B7E9474A3.ditamap
(The system cannot find the file specified) Cause:
java.io.FileNotFoundException:
D:\InfoShare\Data\PublishingService\Data\DataExports\GUID-75CD4383-F94E-49AA-8182-9776535F8522.20120214202004701\1\en\workset\temp\GUID-30956BCB-576E-4180-9CE4-044B7E9474A3.ditamap
(The system cannot find the file specified)
[xslt] Loading stylesheet
D:\InfoShare\App\Utilities\DITA-OT\SEMC_InfoShare\xsl\InfoShare\xslhtml\clean-up.xsl
h3. [xslt] : Fatal Error! Exception thrown by OutputURIResolver Cause:
net.sf.saxon.trans.XPathException: Resolved URL is malformed [xslt]
Failed to process
D:\InfoShare\Data\PublishingService\Data\DataExports\GUID-75CD4383-F94E-49AA-8182-9776535F8522.20120214202004701\1\en\workset\temp\toc.ditamap
Processing ended.

BUILD FAILED

To help you get more background information, the other errors
suppressed and resolutions are described as follows:

First problem:
Fatal error [xslt]
D:\InfoShare\App\Utilities\DITA-OT\SEMC_InfoShare\xsl\InfoShare\common\infoshare.filesystem.xsl:133:
Fatal Error! There is more than one method matching the function call
file:new, and there is insufficient type information to determine
which one should be used
Solutions:
I attempted the following in line with your post entitled Test if an
(image) file exists at
http://www.oxygenxml.com/archives/xsl-list/200506/msg00400.html

modified the problematic XSL either by
From: <xsl:value-of select="file:exists(file:new($filename))"/>

To: <xsl:value-of select="file:exists(file:new($filename as xs:string))"/>

Or change the line 132
From:
<xsl:param name="filename"/>
To:
<xsl:param name=" filename as xs:string "/>

But the above solutions did not come through, which led me to disable
all calls to the named template file-exists. This affects a number of
different XSLs.

The second problem and its solution:
@herf attribute is not allowed in Document() ; Changed all occurrence
of document (@href, ) to result-document(@href, ).
In case the switch from document() to result-document() is
problematic, please could you advise how to fix the error that @href
is not allowed in Document()? in the XSL where the exact problem was
complained about, its version reads ' <xsl:stylesheet version="1.1"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>'.

The Third problem and its solution:
XHTML namespace is not declared in transform.title.xsl Solution : Declared
it.



-- 
Keep an Exacting Eye for Detail

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>