Is there any difference in writing a inline xslt in a xml file(like build.xml) and writing it in different xslt file -


i have written 1 xsl working fine when called xslt ant task. when same script embedded in build.xml giving error on execution.

here xsl :

 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:ee="http://java.sun.com/xml/ns/javaee"> <xsl:output method="xml" indent="yes"/>  <xsl:param name="xmlfilepath"/>  <xsl:param name="updates" select="document($xmlfilepath)" /> <xsl:variable name="updateitemsservlet" select="$updates/ee:web-app/ee:servlet" /> <xsl:variable name="updateitemsservlet-mapping" select="$updates/ee:web-app/ee:servlet-mapping" />  <xsl:template match="@* | node()">     <xsl:copy>         <xsl:apply-templates select="@* | node()"/>     </xsl:copy> </xsl:template>  <xsl:template match="ee:web-app">     <xsl:copy>          <xsl:apply-templates select="@* | node()[not(self::ee:servlet)] | ee:servlet[not(ee:servlet-name = $updateitemsservlet/ee:servlet-name)]" />           <xsl:apply-templates select="$updateitemsservlet" />      </xsl:copy> </xsl:template>    </xsl:stylesheet> 

first input file :

<?xml version="1.0" encoding="utf-8"?>     <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_4.xsd" xsi:schemalocation="http://java.sun.com/xml/ns/javaee/web-app_2_4.xsd" id="processexecutor" version="2.4">         <display-name>processexecutor</display-name>         <context-param>             <param-name>contextconfiglocation</param-name>             <param-value>web-inf/config/beans-stgsuite-enterprise.xml</param-value>         </context-param>         <listener>             <listener-class>org.springframework.web.context.contextloaderlistener             </listener-class>         </listener>         <servlet>             <servlet-name>cxfservlet</servlet-name>             <servlet-class>org.apache.cxf.transport.servlet.cxfservlet</servlet-class>             <load-on-startup>1</load-on-startup>         </servlet>           <servlet-mapping>             <servlet-name>cxfservlet</servlet-name>             <url-pattern>/services/*</url-pattern>         </servlet-mapping>         <servlet>             <servlet-name>download</servlet-name>             <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class>         </servlet>         <servlet-mapping>             <servlet-name>download</servlet-name>             <url-pattern>/download/*</url-pattern>         </servlet-mapping>           <servlet>             <servlet-name>dispatch</servlet-name>             <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class>             <load-on-startup>2</load-on-startup>         </servlet>         <servlet-mapping>             <servlet-name>dispatch</servlet-name>             <url-pattern>/send/*</url-pattern>         </servlet-mapping>     </web-app> 

second input file :

<?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"     xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_4.xsd"     xsi:schemalocation="http://java.sun.com/xml/ns/javaee/web-app_2_4.xsd"     id="processexecutor" version="2.4">      <servlet>         <description>omi getdocument</description>         <display-name>omigetdocument</display-name>         <servlet-name>omigetdocument</servlet-name>         <servlet-class>com.majescomastek.stgicd.policy.commons.utility.getomidocumentchain</servlet-class>         <load-on-startup>1</load-on-startup>     </servlet>     <servlet-mapping>         <servlet-name>omigetdocument</servlet-name>         <url-pattern>/omigetdocservice/*</url-pattern>     </servlet-mapping>     <servlet>         <description>pdf downloader</description>         <display-name>pdfdownloader</display-name>         <servlet-name>pdfdownloader</servlet-name>         <servlet-class>com.majescomastek.ho.comparativerater.pdf.downloader.quoteproposalpdfdownloader</servlet-class>         <load-on-startup>1</load-on-startup>     </servlet>     <servlet-mapping>         <servlet-name>pdfdownloader</servlet-name>         <url-pattern>/pdfservice/*</url-pattern>     </servlet-mapping> </web-app> 

embedded in xml means ..inline xslt. added same xsl in build file below.

<target name="myxslt">    <xslt in="web.xml" out="output.xml">       <param name="xmlfilepath" expression="icd-service-web"/>         <style>                 <string>                     <![cdata[                         <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:ee="http://java.sun.com/xml/ns/javaee"> <xsl:output method="xml" indent="yes"/> <xsl:param name="xmlfilepath"/>  <xsl:param name="updates" select="document($xmlfilepath)" /> <xsl:variable name="updateitemsservlet" select="$updates/ee:web-app/ee:servlet" /> <xsl:variable name="updateitemsservlet-mapping" select="$updates/ee:web-app/ee:servlet-mapping" /> <xsl:template match="@* | node()">     <xsl:copy>         <xsl:apply-templates select="@* | node()"/>     </xsl:copy> </xsl:template> <xsl:template match="ee:web-app">     <xsl:copy>          <xsl:apply-templates select="@* | node()[not(self::ee:servlet)] | ee:servlet[not(ee:servlet-name = $updateitemsservlet/ee:servlet-name)]" />           <xsl:apply-templates select="$updateitemsservlet" />      </xsl:copy> </xsl:template>  </xsl:stylesheet>                     ]]>                 </string>         </style>     </xslt> </target> 


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -