[ 
https://issues.apache.org/jira/browse/CAMEL-6661?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rene Avontuur updated CAMEL-6661:
---------------------------------

    Attachment: XsltUriResolver.patch
                XslIncludetEmptyHrefTest.java
                transform_includes_data.xsl

Three lines need to be added to XsltUriResolver; The attached unit test shows 
that this will solve this issue.
Place the xsl file in: 
camel-core/src/test/resources/org/apache/camel/component/xslt 

> xslt: TransformerException: include href is empty 
> --------------------------------------------------
>
>                 Key: CAMEL-6661
>                 URL: https://issues.apache.org/jira/browse/CAMEL-6661
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-xslt
>    Affects Versions: 2.11.0, 2.11.1
>            Reporter: Per Cederin
>            Priority: Minor
>         Attachments: XslIncludetEmptyHrefTest.java, XsltUriResolver.patch, 
> transform_includes_data.xsl
>
>
> 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>



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to