David Parish | 19 Dec 2007 01:01
Picon

Namespace qualifier in insert block appears to break insert

Problems with insert.

I'm trying this ant task:

	<target name="coachDesignerXSL">
		<echo>Modifying Coach Designer XSL</echo>
		<xmltask
			source="${deploy.target.base}/process-server/applications/teamworks.ear/teamworks.war/coachdesigner/transform/CoachDesigner.xsl"
			dest="${deploy.target.base}/process-server/applications/teamworks.ear/teamworks.war/coachdesigner/transform/CoachDesigner.xsl"
			preservetype="true"
			>
			<insert path="/xsl:stylesheet/xsl:template[ <at> name='head']/xsl:element[ <at> name='HEAD']/xsl:call-template[ <at> name='coachDesignerJavascript']"
position="after">
				<![CDATA[
				<xsl:call/>
				]]>
			</insert>
		</xmltask>
          </target>

This fails with:

D:\tree\trunk\deployment\misc\modifyXML-build.xml:211: Failed to add
text to insert/paste

This works:

	<target name="coachDesignerXSL">
		<echo>Modifying Coach Designer XSL</echo>
		<xmltask
(Continue reading)

Brian Agnew | 20 Dec 2007 13:41
Favicon
Gravatar

Re: Namespace qualifier in insert block appears to break insert

Hi David -

Sorry for the delay in replying. The XML under the <insert> will be
evaluated as a separate standalone XML document prior to insertion, so
that namespace will require a namespace declaration. At least, I suspect
that's the case. I've not had a chance to test that.

Brian

On Wed, December 19, 2007 00:01, David Parish wrote:
> Problems with insert.
>
> I'm trying this ant task:
>
> 	<target name="coachDesignerXSL">
> 		<echo>Modifying Coach Designer XSL</echo>
> 		<xmltask
> 			source="${deploy.target.base}/process-server/applications/teamworks.ear/teamworks.war/coachdesigner/transform/CoachDesigner.xsl"
> 			dest="${deploy.target.base}/process-server/applications/teamworks.ear/teamworks.war/coachdesigner/transform/CoachDesigner.xsl"
> 			preservetype="true"
> 			>
> 			<insert
> path="/xsl:stylesheet/xsl:template[ <at> name='head']/xsl:element[ <at> name='HEAD']/xsl:call-template[ <at> name='coachDesignerJavascript']"
> position="after">
> 				<![CDATA[
> 				<xsl:call/>
> 				]]>
> 			</insert>
> 		</xmltask>
>           </target>
(Continue reading)

j b | 23 Dec 2007 21:13
Picon
Favicon

fyi: Example of using Groovy, Ant, xmlUnit, and xmltask

Presented is an example of how to use Groovy AntBuilder to drive the use of XMLTask to transform an XML file. In addition, shown is how to unit test using the XMLUnit framework.

http://members.cox.net/jbetancourt1/content/GroovyAntXMLTaskXMLUnit.html

Basically, the Groovy AntBuilder reuses the Ant library and eliminates the use of XML as a scripting language.  XML doesn't bother me, but this approach removes the "declaritive" straight jacket (allows procedural coding).

/**
 * Exa mple of using Groovy AntBuilder to invoke XMLTask via Ant API.
 * <at> file Replace.groovy
 * <at> author Josef Betancourt
 * <at> date 20071205T23:14
 */
 def SOURCE='data/storage.xml'
 def DEST='target/storage-new.xml'
 def XPATH='//UNIT[ <at> name=\'widgetB\']/VALUE/ <at> value'
 def VALUE='Y'
 def SYSTEM = 'classpath://some/path/to/dtd/narly.dtd'
 def REMOTE = SYSTEM

 def ant = new AntBuilder()     
 ant.sequential{
    path(id: "path") {
        fileset(dir: 'lib') {
            include(name: "**/*.jar")
        }
    }
           
    ant.taskdef(name:'xmltask',classname: 'com.oopsconsultancy.xmltask.ant.XmlTask',classpathref: 'pat h')
            
    ant.xmltask(source:SOURCE,dest:DEST,expandEntityReferences:false, report:false,system:SYSTEM){           
            entity(remote:REMOTE,local:'')  
// don't use DTD spec'd in DOCTYPE          
            replace(path:XPATH,withText:VALUE)
      } 
 }
// end Replace.groovy script






Never miss a thing. Make Yahoo your homepage.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Xmltask-users mailing list
Xmltask-users@...
https://lists.sourceforge.net/lists/listinfo/xmltask-users

Gmane