[esb-issues] [JBoss JIRA] Updated: (JBESB-3340) XsltAction does not resolve relative uri properly

Jan Vlcinsky (JIRA) jira-events at lists.jboss.org
Tue Jun 8 08:09:38 EDT 2010


     [ https://jira.jboss.org/browse/JBESB-3340?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jan Vlcinsky updated JBESB-3340:
--------------------------------

    Description: 
Xslt relative path are resolved not from the place, template is located, but from bin directory (from which is JBoss started)

	<xsl:variable name="locs" select="document('region/pl/Warszawa.xml')"/>
complains about not being able to find the file in D:\opt\jbossesb-server-4.6\bin\region\pl\Warshawa.xml even though the tempate is located inside of esb package.

Using XSLT 2.0 I tried also 
			<xsl:attribute name="resolvedUri"><xsl:value-of select="resolve-uri('region/pl/Warshawa.xml', base-uri(/))"/></xsl:attribute>
and result shows exactly the same value of "D:\opt\jbossesb-server-4.6\bin\region\pl\Warshawa.xml".

For testing I used this template


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8"/>
<xsl:template match="/">
	<xsl:element name="jbossesb">
	<xsl:attribute name="resolvedUri"><xsl:value-of select="resolve-uri('region/pl/Warshawa.xml', base-uri(/))"/></xsl:attribute>
	<xsl:text>Local name of root element is: </xsl:text><xsl:value-of select="local-name(/*)"/><xsl:text>
	Number of children elements on second level is: </xsl:text><xsl:value-of select="count(/*/*)"/>
	<xsl:text>
	Total number of elements in the document is: </xsl:text><xsl:value-of select="count(//*)"/>
	</xsl:element>
</xsl:template>
</xsl:stylesheet>

and following Esb file
<?xml version="1.0"?>
<jbossesb parameterReloadSecs="5"
 xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd http://anonsvn.jboss.org/repos/labs/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd">
 <providers>
  <fs-provider name="FSprovider1">
   <fs-bus busid="helloFileChannel">
    <fs-message-filter
     directory="D:\var\projects\EsbSimpleFileGate\filegate\input"
     error-delete="false"
     error-directory="D:\var\projects\EsbSimpleFileGate\filegate\error"
     error-suffix=".IN_ERROR" input-suffix=".xml" post-delete="false"
     post-directory="D:\var\projects\EsbSimpleFileGate\filegate\output"
     post-suffix=".sentToEsb" work-suffix=".esbWorking"/>
   </fs-bus>
  </fs-provider>
 </providers>
 <services>
  <service category="myCategory"
   description="Hello World File Action (esb listener)"
   invmScope="GLOBAL" name="myFileListener">
   <listeners>
    <fs-listener busidref="helloFileChannel" is-gateway="true"
     name="FileGateway" poll-frequency-seconds="10"/>
   </listeners>
   <actions mep="OneWay">
    <action class="org.jboss.soa.esb.actions.SystemPrintln" name="printBeforeXslt">
     <property name="message"/>
    </action>
    <action
     class="org.jboss.soa.esb.actions.transformation.xslt.XsltAction" name="XsltAction">
     <property name="templateFile" value="/template-small.xsl"/>
     <property name="resultType" value="STRING"/>
     <property name="failOnWarning" value="true"/>
    </action>
    <action class="org.jboss.soa.esb.actions.SystemPrintln" name="printAfterXslt">
     <property name="message"/>
    </action>
   </actions>
  </service>
 </services>
</jbossesb>



  was:
Xslt relative path are resolved not from the place, template is located, but from bin directory (from which is JBoss started)

	<xsl:variable name="locs" select="document('region/pl/Warszawa.xml')"/>
complains about not being able to find the file in D:\opt\jbossesb-server-4.6\bin\region\pl\Warshawa.xml even though the tempate is located inside of esb package.

Using XSLT 2.0 I tried also 
			<xsl:attribute name="resolvedUri"><xsl:value-of select="resolve-uri('region/pl/Warshawa.xml', base-uri(/))"/></xsl:attribute>
and result is exactly the same.

For testing I used this template


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8"/>
<xsl:template match="/">
	<xsl:element name="jbossesb">
	<xsl:attribute name="resolvedUri"><xsl:value-of select="resolve-uri('region/pl/Warshawa.xml', base-uri(/))"/></xsl:attribute>
	<xsl:text>Local name of root element is: </xsl:text><xsl:value-of select="local-name(/*)"/><xsl:text>
	Number of children elements on second level is: </xsl:text><xsl:value-of select="count(/*/*)"/>
	<xsl:text>
	Total number of elements in the document is: </xsl:text><xsl:value-of select="count(//*)"/>
	</xsl:element>
</xsl:template>
</xsl:stylesheet>

and following Esb file
<?xml version="1.0"?>
<jbossesb parameterReloadSecs="5"
 xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd http://anonsvn.jboss.org/repos/labs/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd">
 <providers>
  <fs-provider name="FSprovider1">
   <fs-bus busid="helloFileChannel">
    <fs-message-filter
     directory="D:\var\projects\EsbSimpleFileGate\filegate\input"
     error-delete="false"
     error-directory="D:\var\projects\EsbSimpleFileGate\filegate\error"
     error-suffix=".IN_ERROR" input-suffix=".xml" post-delete="false"
     post-directory="D:\var\projects\EsbSimpleFileGate\filegate\output"
     post-suffix=".sentToEsb" work-suffix=".esbWorking"/>
   </fs-bus>
  </fs-provider>
 </providers>
 <services>
  <service category="myCategory"
   description="Hello World File Action (esb listener)"
   invmScope="GLOBAL" name="myFileListener">
   <listeners>
    <fs-listener busidref="helloFileChannel" is-gateway="true"
     name="FileGateway" poll-frequency-seconds="10"/>
   </listeners>
   <actions mep="OneWay">
    <action class="org.jboss.soa.esb.actions.SystemPrintln" name="printBeforeXslt">
     <property name="message"/>
    </action>
    <action
     class="org.jboss.soa.esb.actions.transformation.xslt.XsltAction" name="XsltAction">
     <property name="templateFile" value="/template-small.xsl"/>
     <property name="resultType" value="STRING"/>
     <property name="failOnWarning" value="true"/>
    </action>
    <action class="org.jboss.soa.esb.actions.SystemPrintln" name="printAfterXslt">
     <property name="message"/>
    </action>
   </actions>
  </service>
 </services>
</jbossesb>





> XsltAction does not resolve relative uri properly
> -------------------------------------------------
>
>                 Key: JBESB-3340
>                 URL: https://jira.jboss.org/browse/JBESB-3340
>             Project: JBoss ESB
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: Transformation Service
>    Affects Versions: 4.6
>         Environment: Windows XP Pro, CZ, JBossESB Server 4.6 with Sun JDK 1.6.0_17using javax.xml.transform.TransformerFactory=net.sf.saxon.TransformerFactoryImpl
>            Reporter: Jan Vlcinsky
>         Attachments: jboss-esb.xml, template-small.xsl
>
>
> Xslt relative path are resolved not from the place, template is located, but from bin directory (from which is JBoss started)
> 	<xsl:variable name="locs" select="document('region/pl/Warszawa.xml')"/>
> complains about not being able to find the file in D:\opt\jbossesb-server-4.6\bin\region\pl\Warshawa.xml even though the tempate is located inside of esb package.
> Using XSLT 2.0 I tried also 
> 			<xsl:attribute name="resolvedUri"><xsl:value-of select="resolve-uri('region/pl/Warshawa.xml', base-uri(/))"/></xsl:attribute>
> and result shows exactly the same value of "D:\opt\jbossesb-server-4.6\bin\region\pl\Warshawa.xml".
> For testing I used this template
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="xml" encoding="UTF-8"/>
> <xsl:template match="/">
> 	<xsl:element name="jbossesb">
> 	<xsl:attribute name="resolvedUri"><xsl:value-of select="resolve-uri('region/pl/Warshawa.xml', base-uri(/))"/></xsl:attribute>
> 	<xsl:text>Local name of root element is: </xsl:text><xsl:value-of select="local-name(/*)"/><xsl:text>
> 	Number of children elements on second level is: </xsl:text><xsl:value-of select="count(/*/*)"/>
> 	<xsl:text>
> 	Total number of elements in the document is: </xsl:text><xsl:value-of select="count(//*)"/>
> 	</xsl:element>
> </xsl:template>
> </xsl:stylesheet>
> and following Esb file
> <?xml version="1.0"?>
> <jbossesb parameterReloadSecs="5"
>  xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd"
>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd http://anonsvn.jboss.org/repos/labs/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd">
>  <providers>
>   <fs-provider name="FSprovider1">
>    <fs-bus busid="helloFileChannel">
>     <fs-message-filter
>      directory="D:\var\projects\EsbSimpleFileGate\filegate\input"
>      error-delete="false"
>      error-directory="D:\var\projects\EsbSimpleFileGate\filegate\error"
>      error-suffix=".IN_ERROR" input-suffix=".xml" post-delete="false"
>      post-directory="D:\var\projects\EsbSimpleFileGate\filegate\output"
>      post-suffix=".sentToEsb" work-suffix=".esbWorking"/>
>    </fs-bus>
>   </fs-provider>
>  </providers>
>  <services>
>   <service category="myCategory"
>    description="Hello World File Action (esb listener)"
>    invmScope="GLOBAL" name="myFileListener">
>    <listeners>
>     <fs-listener busidref="helloFileChannel" is-gateway="true"
>      name="FileGateway" poll-frequency-seconds="10"/>
>    </listeners>
>    <actions mep="OneWay">
>     <action class="org.jboss.soa.esb.actions.SystemPrintln" name="printBeforeXslt">
>      <property name="message"/>
>     </action>
>     <action
>      class="org.jboss.soa.esb.actions.transformation.xslt.XsltAction" name="XsltAction">
>      <property name="templateFile" value="/template-small.xsl"/>
>      <property name="resultType" value="STRING"/>
>      <property name="failOnWarning" value="true"/>
>     </action>
>     <action class="org.jboss.soa.esb.actions.SystemPrintln" name="printAfterXslt">
>      <property name="message"/>
>     </action>
>    </actions>
>   </service>
>  </services>
> </jbossesb>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the esb-issues mailing list