Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-6661

xslt: TransformerException: include href is empty

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.11.0, 2.11.1
    • 2.11.3, 2.12.3, 2.13.0
    • camel-xslt
    • None
    • Unknown

    Description

      The use of the xlst function, document(''), gives an exception like:

      "javax.xml.transform.TransformerException: include href is empty"

      when transforming, using the component camel-xslt.

      It seems that camels XsltUriResolver only is capable to handle files
      either from the classpath or the file system.
      With the xlst function, document(''), the xslt processor should be able to handle that the result
      "is the source XML of the XSLT document itself".

      Below is an example.

      A XML document:
      <?xml version="1.0" encoding="ISO-8859-1"?>
      <root>1</root>

      A XSL document:
      <?xml version="1.0" encoding="UTF-8"?>
      <xsl:stylesheet xmlns:date="http://exslt.org/dates-and-times" version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <date:months>
      <date:month length="31" abbr="Jan">January</date:month>
      <date:month length="28" abbr="Feb">February</date:month>
      </date:months>
      <xsl:template match="root">
      <xsl:variable name="month-node" select="document('')/*/date:months/date:month[number(2)]"/>
      <xsl:element name="MyDate">
      <xsl:value-of select="$month-node"/>
      </xsl:element>
      </xsl:template>
      </xsl:stylesheet>

      After transformation the following should be produced:
      <?xml version="1.0" encoding="UTF-8"?><MyDate>February</MyDate>

      Attachments

        1. XsltUriResolver.patch
          0.7 kB
          Rene Avontuur
        2. XslIncludetEmptyHrefTest.java
          2 kB
          Rene Avontuur
        3. transform_includes_data.xsl
          1 kB
          Rene Avontuur

        Activity

          People

            njiang Willem Jiang
            p_cedde Per Cederin
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: