commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/betwixt input.xml makeBetwixt.jelly
Date Wed, 15 Jan 2003 23:46:47 GMT
dion        2003/01/15 15:46:47

  Added:       jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/schematron
                        skeleton1-5.xsl transformSchematronExample.jelly
                        test-schematron.xml source.xml
                        schematron-wrapper.xsl
               jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml
                        transformParamExample2.jelly
                        transformExampleAllInLine.jelly
                        transformExampleSAXOutputNestedTransforms.jelly
                        transformExampleXmlVar.xml
                        transformExampleXmlVar.jelly transformExample5.xsl
                        TestXMLTags.java TestJelly.java
                        transformParamExample.xsl suite.jelly example.jelly
                        transformExample4.xsl transformParamExample.xml
                        testExpressions.jelly transformExample1.xsl
                        transformExample3.xsl testDoctype.jelly
                        testForEach.jelly xpathSortExample.jelly dummy.xml
                        transformExample2.xsl
                        transformExampleSAXOutput.jelly
                        transformExample.jelly filesetExample.jelly
                        transformExample.xsl transformParamExample.jelly
               jelly/jelly-tags/xml maven.xml project.xml .cvsignore
                        project.properties
               jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/betwixt
                        input.xml makeBetwixt.jelly
  Log:
  Move xml taglib out of core
  
  Revision  Changes    Path
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/schematron/skeleton1-5.xsl
  
  Index: skeleton1-5.xsl
  ===================================================================
  <?xml version="1.0"?>
  <!-- Beta Skeleton Module for the Schematron 1.5 XML Schema Language.
  	http://www.ascc.net/xml/schematron/
   
   Copyright (c) 2000,2001 Rick Jelliffe and Academia Sinica Computing Center, Taiwan
  
   This software is provided 'as-is', without any express or implied warranty. 
   In no event will the authors be held liable for any damages arising from 
   the use of this software.
  
   Permission is granted to anyone to use this software for any purpose, 
   including commercial applications, and to alter it and redistribute it freely,
   subject to the following restrictions:
  
   1. The origin of this software must not be misrepresented; you must not claim
   that you wrote the original software. If you use this software in a product, 
   an acknowledgment in the product documentation would be appreciated but is 
   not required.
  
   2. Altered source versions must be plainly marked as such, and must not be 
   misrepresented as being the original software.
  
   3. This notice may not be removed or altered from any source distribution.
  -->
  <!-- 
      Version: 2001-06-12
             * same skeleton now supports namespace or no namespace
             * parameters to handlers updated for all 1.5 attributes 
             * diagnostic hints supported: command-line option diagnose=yes|no
             * phases supported: command-line option phase=#ALL|...
             * abstract rules
             * compile-time error messages
             * 1.6 feature: @match on sch:key  
            
      Contributors: Rick Jelliffe (original), Oliver Becker (architecture), 
               Miloslav Nic (diagnostic, phase, options), Ludwig Svenonius (abstract)
               Uche Ogbuji (misc. bug fixes), Jim Ancona (SAXON workaround),
               Eddie Robertsson (misc. bug fixes)
  
      XSLT versions tested and working as-is: 
             * MS XML 3
             * Oracle 
             * SAXON + Instant Saxon  
             * XT n.b. key() not available, will die
  
     XSLT version reliably reported working
             *  FourThought's Python implementation
  
      XSLT versions tested and requires small workaround from you
             * Sablotron does not support import, so merge meta-stylesheets by hand
             * Xalan for Java 2.0 outputs wrong namespace URI, so alter by hand or script
             * Xalan for C 1.0 has problem with key, so edit by hand. Find "KEY" below  
  
     If you create your own meta-stylesheet to override this one, it is a
     good idea to have both in the same directory and to run the stylesheet
     from that directory, as many XSLT implementations have ideosyncratic
     handling of URLs: keep it simple.
           
  -->
  <xsl:stylesheet version="1.0" 
  	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  	xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias" 
  	xmlns:sch="http://www.ascc.net/xml/schematron"
  	 >
  <!-- Note that this namespace is not version specific.
  This program implements schematron 1.5 with some 1.6 extensions -->
  <xsl:namespace-alias stylesheet-prefix="axsl" result-prefix="xsl"/>
  <!-- Category: top-level-element -->
  <xsl:output method="xml" omit-xml-declaration="no" standalone="yes"  indent="yes"/>
  <xsl:param name="block"></xsl:param><!-- reserved -->
  <xsl:param name="phase">
    <xsl:choose>
      <xsl:when test="//sch:schema/@defaultPhase">
        <xsl:value-of select="//sch:schema/@defaultPhase"/>
      </xsl:when>
      <xsl:otherwise>#ALL</xsl:otherwise>
    </xsl:choose>
  </xsl:param>
  <xsl:param name="hiddenKey"> key </xsl:param><!-- workaround for Xalan4J 2.0 -->
  
  <!-- SCHEMA -->
  <xsl:template match="sch:schema | schema">
  	<axsl:stylesheet version="1.0">
  		<xsl:for-each select="sch:ns | ns">
  			<xsl:attribute name="{concat(@prefix,':dummy-for-xmlns')}" namespace="{@uri}"/>
  		</xsl:for-each>
   
  		<xsl:if test="count(sch:title/* | title/* )">
  			<xsl:message>
  				<xsl:text>Warning: </xsl:text>
  				<xsl:value-of select="name(.)"/>
  				<xsl:text> must not contain any child elements</xsl:text>
  			</xsl:message>
  		</xsl:if>
   
  		<xsl:call-template name="process-prolog"/>
  		<!-- utility routine for implementations -->
     		<axsl:template match="*|@*" mode="schematron-get-full-path">
  
  			<axsl:apply-templates select="parent::*" mode="schematron-get-full-path"/>
  			<axsl:text>/</axsl:text>
  			<axsl:if test="count(. | ../@*) = count(../@*)">@</axsl:if>
  			<axsl:value-of select="name()"/>
  			<axsl:text>[</axsl:text>
  	  		<axsl:value-of select="1+count(preceding-sibling::*[name()=name(current())])"/>
  	  		<axsl:text>]</axsl:text>
         	 	</axsl:template>
  
  		<xsl:apply-templates mode="do-keys" 
                  select="sch:pattern/sch:rule/sch:key | pattern/rule/key | sch:key | key "/>
  
  
  		<axsl:template match="/">
  			<xsl:call-template name="process-root">
  				<xsl:with-param name="fpi" select="@fpi"/>
  				<xsl:with-param 	xmlns:sch="http://www.ascc.net/xml/schematron"
  				name="title" select="./sch:title | title"/>
  				<xsl:with-param name="id" select="@id"/>
  				<xsl:with-param name="icon" select="@icon"/>
  				<xsl:with-param name="lang" select="@xml:lang"/>
  				<xsl:with-param name="version" select="@version" />
  				<xsl:with-param name="schemaVersion" select="@schemaVersion" />
  				<xsl:with-param name="contents">
  					<xsl:apply-templates mode="do-all-patterns"/>
  				</xsl:with-param>
  			</xsl:call-template>
  		</axsl:template>
   
  		<xsl:apply-templates/>
  		<axsl:template match="text()" priority="-1">
  			<!-- strip characters -->
  		</axsl:template>
  	</axsl:stylesheet>
  </xsl:template>
  
  	<!-- ACTIVE -->
  	<xsl:template match="sch:active | active">
                  <xsl:if test="not(@pattern)">
                      <xsl:message>Markup Error: no pattern attribute in &lt;active></xsl:message>
                  </xsl:if>
                  <xsl:if test="//sch:rule[@id= current()/@pattern]">
                      <xsl:message>Reference Error: the pattern  "<xsl:value-of select="@pattern"/>" has been activated but is not declared</xsl:message>
                  </xsl:if>
          </xsl:template>
  
  	<!-- ASSERT and REPORT -->
  	<xsl:template match="sch:assert | assert">
                  <xsl:if test="not(@test)">
                      <xsl:message>Markup Error: no test attribute in &lt;assert></xsl:message>
                  </xsl:if>
  		<axsl:choose>
  			<axsl:when test="{@test}"/>
  			<axsl:otherwise>
  				<xsl:call-template name="process-assert">
  					<xsl:with-param name="role" select="@role"/>
  					<xsl:with-param name="id" select="@id"/>
  					<xsl:with-param name="test" select="normalize-space(@test)" />
  					<xsl:with-param name="icon" select="@icon"/>
  					<xsl:with-param name="subject" select="@subject"/>
  					<xsl:with-param name="diagnostics" select="@diagnostics"/>
  				</xsl:call-template>  
  			</axsl:otherwise>
  		</axsl:choose>
  	</xsl:template>
  	<xsl:template match="sch:report | report">
                  <xsl:if test="not(@test)">
                      <xsl:message>Markup Error: no test attribute in &lt;report></xsl:message>
                  </xsl:if>
  		<axsl:if test="{@test}">
  			<xsl:call-template name="process-report">
  				<xsl:with-param name="role" select="@role"/>
  				<xsl:with-param name="test" select="normalize-space(@test)" />
  				<xsl:with-param name="icon" select="@icon"/>
  				<xsl:with-param name="id" select="@id"/>
  				<xsl:with-param name="subject" select="@subject"/>
  				<xsl:with-param name="diagnostics" select="@diagnostics"/>
  			</xsl:call-template>
  		</axsl:if>
  	</xsl:template>
  
  
  	<!-- DIAGNOSTIC -->
  	<xsl:template match="sch:diagnostic | diagnostic"
                ><xsl:if test="not(@id)"
                      ><xsl:message>Markup Error: no id attribute in &lt;diagnostic></xsl:message
                  ></xsl:if><xsl:call-template name="process-diagnostic">
                  <xsl:with-param name="id" select="@id" />
                 </xsl:call-template>
          </xsl:template>
  
  	<!-- DIAGNOSTICS -->
  	<xsl:template match="sch:diagnostics | diagnostics"/>
  
  	<!-- DIR -->
  	<xsl:template match="sch:dir | dir"  mode="text"
  		><xsl:call-template name="process-dir">
  			<xsl:with-param name="value" select="@value"/>
  		</xsl:call-template>
  	</xsl:template>
  
  	<!-- EMPH -->
  	<xsl:template match="sch:emph | emph"  mode="text"
  		><xsl:call-template name="process-emph"/>
  	</xsl:template>
  
  	<!-- EXTENDS -->
  	<xsl:template match="sch:extends | extends">
  		<xsl:if test="not(@rule)"
                      ><xsl:message>Markup Error: no rule attribute in &lt;extends></xsl:message
                  ></xsl:if>
       		<xsl:if test="not(//sch:rule[@abstract='true'][@id= current()/@rule] )
                      and not(//rule[@abstract='true'][@id= current()/@rule])">
                      <xsl:message>Reference Error: the abstract rule  "<xsl:value-of select="@rule"/>" has been referenced but is not declared</xsl:message>
                  </xsl:if>
  	        <xsl:call-template name="IamEmpty" />
  
    		<xsl:if test="//sch:rule[@id=current()/@rule]">
      			<xsl:apply-templates select="//sch:rule[@id=current()/@rule]"
  				mode="extends"/>
    		</xsl:if>
  
  	</xsl:template>
  
  	<!-- KEY -->
  	<!-- do we need something to test uniqueness too? --> 
  	<!-- NOTE: if you get complaint about "key" here (e.g. Xalan4C 1.0) replace
  		"key" with "$hiddenKey" -->
  	<xsl:template  match="sch:key | key " mode="do-keys" >
                  <xsl:if test="not(@name)">
                      <xsl:message>Markup Error: no name attribute in &lt;key></xsl:message>
                  </xsl:if>
                 <xsl:if test="not(@match) and not(../sch:rule)">
                      <xsl:message>Markup Error:  no match attribute on &lt;key> outside &lt;rule></xsl:message>
                  </xsl:if>
                  <xsl:if test="not(@path)">
                      <xsl:message>Markup Error: no path attribute in &lt;key></xsl:message>
                  </xsl:if>
  	        <xsl:call-template name="IamEmpty" />
  
               <xsl:choose>
  			<xsl:when test="@match">
  				<axsl:key match="{@match}" name="{@name}" use="{@path}"/>
  			</xsl:when>
  			<xsl:otherwise>
  				<axsl:key name="{@name}" match="{parent::sch:rule/@context}" use="{@path}"/>
  			</xsl:otherwise>
  		</xsl:choose>
  	</xsl:template>
  
        <xsl:template match="sch:key | key"  /><!-- swallow --> 
  
  	<!-- NAME -->
  	<xsl:template match="sch:name | name" mode="text">
  		<axsl:text xml:space="preserve"> </axsl:text>
  			<xsl:if test="@path"
  				><xsl:call-template name="process-name">
  					<xsl:with-param name="name" select="concat('name(',@path,')')"/>
  					<!-- SAXON needs that instead of  select="'name({@path})'"  -->
  				</xsl:call-template>
  			</xsl:if>
  			<xsl:if test="not(@path)"
  				><xsl:call-template name="process-name">
  					<xsl:with-param name="name" select="'name(.)'"/>
  				</xsl:call-template>
  			</xsl:if>
  	        	<xsl:call-template name="IamEmpty" />
  		<axsl:text xml:space="preserve"> </axsl:text>
  	</xsl:template>
  
  	<!-- NS -->
  	<xsl:template match="sch:ns | ns"  mode="do-all-patterns" >
                 <xsl:if test="not(@uri)">
                      <xsl:message>Markup Error: no uri attribute in &lt;ns></xsl:message>
                  </xsl:if>
                 <xsl:if test="not(@prefix)">
                      <xsl:message>Markup Error: no prefix attribute in &lt;ns></xsl:message>
                  </xsl:if>
  	        <xsl:call-template name="IamEmpty" />
  		<xsl:call-template name="process-ns" >
  			<xsl:with-param name="prefix" select="@prefix"/>
  			<xsl:with-param name="uri" select="@uri"/>
  		</xsl:call-template>
  	</xsl:template>
  	<xsl:template match="sch:ns | ns"  /><!-- swallow -->
  
  	<!-- P -->
  	<xsl:template match="sch:schema/sch:p | schema/p" mode="do-schema-p" >
  		<xsl:call-template name="process-p">
  			<xsl:with-param name="class" select="@class"/>
  			<xsl:with-param name="icon" select="@icon"/>
  			<xsl:with-param name="id" select="@id"/>
  			<xsl:with-param name="lang" select="@xml:lang"/>
  		</xsl:call-template>
  	</xsl:template>
  	<xsl:template match="sch:pattern/sch:p | pattern/p" mode="do-pattern-p" >
  		<xsl:call-template name="process-p">
  			<xsl:with-param name="class" select="@class"/>
  			<xsl:with-param name="icon" select="@icon"/>
  			<xsl:with-param name="id" select="@id"/>
  			<xsl:with-param name="lang" select="@xml:lang"/>
  		</xsl:call-template>
  	</xsl:template>
  	<xsl:template match="sch:phase/sch:p" /><!-- We don't use these -->
  	<xsl:template match="sch:p | p" />
  
  	<!-- PATTERN -->
  	<xsl:template match="sch:pattern | pattern" mode="do-all-patterns">
  	<xsl:if test="($phase = '#ALL') 
  	or (../sch:phase[@id= ($phase)]/sch:active[@pattern= current()/@id])
  	or (../phase[@id= ($phase)]/active[@id= current()/@id])">
  		<xsl:call-template name="process-pattern">
  			<xsl:with-param name="name" select="@name"/>
  			<xsl:with-param name="id" select="@id"/>
  			<xsl:with-param name="see" select="@see"/>
  			<xsl:with-param name="fpi" select="@fpi"/>
  			<xsl:with-param name="icon" select="@icon"/>
  		</xsl:call-template>
  		<axsl:apply-templates select="/" mode="M{count(preceding-sibling::*)}"/>
          </xsl:if>
  	</xsl:template>
  	
  	<xsl:template match="sch:pattern | pattern">
          <xsl:if test="($phase = '#ALL') 
  	or (../sch:phase[@id= ($phase)]/sch:active[@pattern= current()/@id])
  	or (../phase[@id= ($phase)]/active[@id= current()/@id])">
  		<xsl:apply-templates/>
  		<axsl:template match="text()" priority="-1" mode="M{count(preceding-sibling::*)}">
  			<!-- strip characters -->
  		</axsl:template>
          </xsl:if>
  	</xsl:template>
  
  	<!-- PHASE -->
  	<xsl:template match="sch:phase | phase" >
                  <xsl:if test="not(@id)">
                      <xsl:message>Markup Error: no id attribute in &lt;phase></xsl:message>
                  </xsl:if>
  	</xsl:template>
  
  	<!-- RULE -->
  	<xsl:template match="sch:rule[not(@abstract='true')] | rule[not(@abstract='true')]">
                  <xsl:if test="not(@context)">
                      <xsl:message>Markup Error: no context attribute in &lt;rule></xsl:message>
                  </xsl:if>
  		<axsl:template match="{@context}" priority="{4000 - count(preceding-sibling::*)}" mode="M{count(../preceding-sibling::*)}">
  			<xsl:call-template name="process-rule">
  				<xsl:with-param name="id" select="@id"/>
  				<xsl:with-param name="context" select="@context"/>
  				<xsl:with-param name="role" select="@role"/>
  			</xsl:call-template>
  			<xsl:apply-templates/>
  			<axsl:apply-templates mode="M{count(../preceding-sibling::*)}"/>
  		</axsl:template>
  	</xsl:template>
  
  
  	<!-- ABSTRACT RULE -->
  	<xsl:template match="sch:rule[@abstract='true'] | rule[@abstract='true']" >
  		<xsl:if test=" not(@id)">
                      <xsl:message>Markup Error: no id attribute on abstract &lt;rule></xsl:message>
                  </xsl:if>
   		<xsl:if test="@context">
                      <xsl:message>Markup Error: (2) context attribute on abstract &lt;rule></xsl:message>
                  </xsl:if>
  	</xsl:template>
  
  	<xsl:template match="sch:rule[@abstract='true'] | rule[@abstract='true']"
  		mode="extends" >
                  <xsl:if test="@context">
                      <xsl:message>Markup Error: context attribute on abstract &lt;rule></xsl:message>
                  </xsl:if>
  			<xsl:apply-templates/>
  	</xsl:template>
  
  	<!-- SPAN -->
  	<xsl:template match="sch:span | span" mode="text">
  		<xsl:call-template name="process-span"
  			><xsl:with-param name="class" select="@class"/>
  		</xsl:call-template>
  	</xsl:template>
  
  	<!-- TITLE -->
  	<!-- swallow -->
  	<xsl:template match="sch:title | title" /> 
  
  	<!-- VALUE-OF -->
  	<xsl:template match="sch:value-of | value-of" mode="text" >
                 <xsl:if test="not(@select)">
                      <xsl:message>Markup Error: no select attribute in &lt;value-of></xsl:message>
                  </xsl:if>
  	        <xsl:call-template name="IamEmpty" />
  		<axsl:text xml:space="preserve"> </axsl:text>
  		<xsl:choose>
  			<xsl:when test="@select"
  				><xsl:call-template name="process-value-of">
  					<xsl:with-param name="select" select="@select"/>  
                                     <!-- will saxon have problem with this too?? -->
  				</xsl:call-template>
  			</xsl:when>
  			<xsl:otherwise >
  				<xsl:call-template name="process-value-of"
  					><xsl:with-param name="select" select="'.'"/>
  				</xsl:call-template>
  			</xsl:otherwise>
                  </xsl:choose>
  		<axsl:text xml:space="preserve"> </axsl:text>
  	</xsl:template>
  
  <!-- ============================================================== -->
  	<!-- Text -->
  	<xsl:template match="text()" priority="-1" mode="do-keys">
  		<!-- strip characters -->
  	</xsl:template>
  	<xsl:template match="text()" priority="-1" mode="do-all-patterns">
  		<!-- strip characters -->
  	</xsl:template>
          <xsl:template match="text()" priority="-1" mode="do-schema-p">
  		<!-- strip characters -->
  	</xsl:template>
          <xsl:template match="text()" priority="-1" mode="do-pattern-p">
  		<!-- strip characters -->
  	</xsl:template>
  	<xsl:template match="text()" priority="-1">
  		<!-- strip characters -->
  	</xsl:template>
  	<xsl:template match="text()" mode="text">
  		<xsl:value-of select="normalize-space(.)"/>
  	</xsl:template>
  
  	<xsl:template match="text()" mode="inline-text">
  		<xsl:value-of select="."/>
  	</xsl:template>
  
  <!-- ============================================================== -->
  <!-- utility templates -->
  <xsl:template name="IamEmpty">
  	<xsl:if test="count( * )">
  		<xsl:message>
  			<xsl:text>Warning: </xsl:text>
  			<xsl:value-of select="name(.)"/>
  			<xsl:text> must not contain any child elements</xsl:text>
  		</xsl:message>
  	</xsl:if>
  </xsl:template>
  
  <xsl:template name="diagnosticsSplit">
    <!-- Process at the current point the first of the <diagnostic> elements
         referred to parameter str, and then recurse -->
    <xsl:param name="str"/>
    <xsl:variable name="start">
      <xsl:choose>
        <xsl:when test="contains($str,' ')">
  	<xsl:value-of  select="substring-before($str,' ')"/>
        </xsl:when>
        <xsl:otherwise><xsl:value-of select="$str"/></xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
  
    <xsl:variable name="end">
      <xsl:if test="contains($str,' ')">
        <xsl:value-of select="substring-after($str,' ')"/>
      </xsl:if>
    </xsl:variable>
  
    <xsl:if test="not(string-length(normalize-space($start)) = 0)
  	and not(//sch:diagnostic[@id = ($start)]) and not(//diagnostic[@id = ($start)])">
  	<xsl:message>Reference error: A diagnostic "<xsl:value-of select="string($start)"/>" has been referenced but is not declared</xsl:message>
    </xsl:if>
  
    <xsl:if test="string-length(normalize-space($start)) > 0">
       <xsl:apply-templates 
          select="//sch:diagnostic[@id = ($start) ] | //diagnostic[@id= ($start) ]"/>
    </xsl:if>
  
    <xsl:if test="not($end='')">
      <xsl:call-template name="diagnosticsSplit">
        <xsl:with-param name="str" select="$end"/>
      </xsl:call-template>
    </xsl:if>
  </xsl:template>
  
  
  <!-- ============================================================== -->
  
  	<xsl:template match="*">
  		<xsl:message>
  			<xsl:text>Warning: unrecognized element </xsl:text>
  			<xsl:value-of select="name(.)"/>
  		</xsl:message>
  	</xsl:template>
  	<xsl:template match="*" mode="text">
  		<xsl:message>
  			<xsl:text>Warning: unrecognized element </xsl:text>
  			<xsl:value-of select="name(.)"/>
  		</xsl:message>
  	</xsl:template>
  <!-- ============================================================== -->
  	<!-- Default named templates -->
  	<!-- These are the actions that are performed unless overridden -->
  	<xsl:template name="process-prolog"/>
  	<!-- no params -->
  	<xsl:template name="process-root">
  		<xsl:param name="contents"/>
  		<!-- unused params: fpi, title, id, icon, lang, version, schemaVersion -->
  		<xsl:copy-of select="$contents"/>
  	</xsl:template>
  	<xsl:template name="process-assert">
  		<xsl:param name="role"/>
  		<xsl:param name="test"/>
  		<!-- unused parameters: id, icon, diagnostics, subject -->
  		<xsl:call-template name="process-message">
  			<xsl:with-param name="pattern" select="$test"/>
  			<xsl:with-param name="role" select="$role"/>
  		</xsl:call-template>
  	</xsl:template>
  	<xsl:template name="process-report">
  		<xsl:param name="role"/>
  		<xsl:param name="test"/>
  		<!-- unused parameters: id, icon, diagnostics, subject -->
  		<xsl:call-template name="process-message">
  			<xsl:with-param name="pattern" select="$test"/>
  			<xsl:with-param name="role" select="$role"/>
  		</xsl:call-template>
  	</xsl:template>
  	<xsl:template name="process-diagnostic">
  		<!-- params: id -->
  		<xsl:apply-templates mode="text"/>
  	</xsl:template>
  	<xsl:template name="process-dir" 
  		><xsl:apply-templates mode="inline-text"/></xsl:template>
  	<xsl:template name="process-emph" 
  		><xsl:apply-templates mode="inline-text"/></xsl:template>
  	<xsl:template name="process-name">
  		<xsl:param name="name"
  		/><axsl:value-of select="{$name}"/></xsl:template>
  	<xsl:template name="process-ns" />
  	<!-- unused params: prefix, uri -->
  	<!-- note that this is independent of the use of sch:ns by sch:schema -->
  	<xsl:template name="process-p"/>
  	<!-- unused params: class, id, icon, lang -->
  	<xsl:template name="process-pattern"/>
  	<!-- unused params: name, id, see, fpi, icon -->
  	<xsl:template name="process-rule"/>
  	<!-- unused params: id, context, role -->
  	<xsl:template name="process-span" 
  		><xsl:apply-templates mode="inline-test"/></xsl:template>
  	<xsl:template name="process-value-of">
  		<xsl:param name="select"
  		/><axsl:value-of select="{$select}"/></xsl:template>
  	<!-- default output action: the simplest customization is to just override this -->
  	<xsl:template name="process-message">
  		<!-- params: pattern, role -->
  		<xsl:apply-templates mode="text"/>
  	</xsl:template>
  </xsl:stylesheet>
  
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/schematron/transformSchematronExample.jelly
  
  Index: transformSchematronExample.jelly
  ===================================================================
  <?xml version="1.0"?>
  <j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml">
  
    <x:transform
       xml="test-schematron.xml"
       xslt="schematron-wrapper.xsl"
       var="test_schematron"/>
  
    <x:transform
       xml="source.xml"
       xslt="${test_schematron}" var="doc"/>
  
    Report count=<x:expr select="count($doc//report)"/>:assert count=<x:expr select="count($doc//assert)"/>
  
  </j:jelly>
  
  
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/schematron/test-schematron.xml
  
  Index: test-schematron.xml
  ===================================================================
  <sch:schema xmlns:sch="http://www.ascc.net/xml/schematron"
                   icon="http://www.ascc.net/xml/resource/schematron/bilby.jpg"
                   defaultPhase="built">
  
               <sch:p>This is an example schema for the <emph>Building Projects XML</emph> language.</sch:p>
  
               <sch:phase id="underConstruction">
                  <sch:active pattern="construction"></sch:active>
                  <sch:active pattern="admin"></sch:active>
               </sch:phase>
  
               <sch:phase id="built">
                  <sch:active pattern="completed">completed</sch:active>
                  <sch:active pattern="admin">admin</sch:active>
               </sch:phase>
  
  
               <sch:pattern name="Construction Checks" id="construction">
  
                  <sch:p>Constraints which are applied during construction</sch:p>
  
                  <sch:rule context="house">
                     <sch:assert test="count(wall) = 4" diagnostics="1">A house should have 4 walls</sch:assert>
                     <sch:report test="not(roof)" diagnostics="2">The house is incomplete, it still needs a roof</sch:report>
                     <sch:assert test="builder">An incomplete house must have
                     a builder assigned to it</sch:assert>
                     <sch:assert test="not(owner)">An incomplete house cannot have an owner</sch:assert>
                  </sch:rule>
  
               </sch:pattern>
  
               <sch:pattern name="Final Checks" id="completed">
                  <sch:p>Constraints which are applied after construction</sch:p>
  
                  <sch:rule context="house">
                     <sch:assert test="count(wall)= 4" diagnostics="1">A house should have 4 walls</sch:assert>
                     <sch:report test="not(roof)" diagnostics="2">The house is incomplete, it still needs a roof</sch:report>
                     <sch:assert test="owner">An incomplete house must have
                     an owner</sch:assert>
                     <sch:assert test="not(builder)">An incomplete house doesn't need a builder</sch:assert>
                  </sch:rule>
  
               </sch:pattern>
  
               <sch:pattern name="Adminstration Checks" id="admin">
  
                  <sch:p>Adminstrative constraints which are <sch:emph>always</sch:emph> applied</sch:p>
  
                  <sch:rule context="house">
                     <sch:assert test="address">A house must have an address</sch:assert>
                  </sch:rule>
  
                  <sch:rule context="address">
                     <sch:assert test="count(*) = count(street) + count(town) + count(postcode)">
                     An address may only include street, town and postcode elements.
                     </sch:assert>
                     <sch:assert test="street">An address must include the street details</sch:assert>
                     <sch:assert test="town">An address must identify the town</sch:assert>
                     <sch:assert test="postcode">An address must have a postcode</sch:assert>
                  </sch:rule>
  
  
                  <sch:rule abstract="true" id="nameChecks">
                     <sch:assert test="firstname">A <name/> element must have a first name</sch:assert>
                     <sch:assert test="lastname">A <name/> element must have a last name</sch:assert>
                  </sch:rule>
  
                  <sch:rule context="builder">
                     <sch:extends rule="nameChecks"></sch:extends>
                     <sch:assert test="certification">A <name/> must be certified</sch:assert>
                  </sch:rule>
  
                  <sch:rule context="owner">
                     <sch:extends rule="nameChecks"></sch:extends>
                     <sch:assert test="telephone">An <name/> must have a telephone</sch:assert>
                  </sch:rule>
  
                  <sch:rule context="certification">
                     <sch:assert test="@number">Certification numbers must be recorded
                     in the number attribute</sch:assert>
                  </sch:rule>
  
               </sch:pattern>
  
               <diagnostics>
                  <diagnostic id="1">
                      Its an odd house which has more or less than four walls! Consult your architect...
                  </diagnostic>
  
                  <diagnostic id="2">
                      Its an odd house which has no roof! Consult your architect...
                  </diagnostic>
  
               </diagnostics>
  
           </sch:schema>
  
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/schematron/source.xml
  
  Index: source.xml
  ===================================================================
  <?xml version="1.0"?>
  <house>
           <wall/>
           <wall/>
           <wall/>
           <wall/>
           <address>
              <street>1 The High Street</street>
              <town>New Town</town>
              <postcode>NT1</postcode>
           </address>
           <builder>
              <firstname>Bob</firstname>
              <lastname>Builder</lastname>
              <certification number="123"/>
           </builder>
        </house>
  
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/schematron/schematron-wrapper.xsl
  
  Index: schematron-wrapper.xsl
  ===================================================================
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  
        <!-- import the basic framework -->
        <xsl:import href="skeleton1-5.xsl"/>
  
        <!-- override the process-root template and wrap output as HTML -->
        <!--xsl:template name="process-root">
           <xsl:param name="title"/>
           <xsl:param name="contents" />
           <html>
              <head><title>Validation Report For: <xsl:value-of select="$title"/></title></head>
              <body>
              <h1>Validation Report For : <xsl:value-of select="$title"/></h1>
  
              <pre>
              <xsl:copy-of select="$contents" />
              </pre>
  
              </body>
           </html>
        </xsl:template-->
  
        <xsl:template name="process-root">
           <xsl:param name="title"/>
           <xsl:param name="contents" />
           <schematron-validation>Validation Report For: <xsl:value-of select="$title"/>
           <xsl:copy-of select="$contents" />
           </schematron-validation>
        </xsl:template>
  
        <!-- override additional templates as needed -->
      <xsl:template name="process-assert">
          <xsl:param name="role"/>
          <xsl:param name="id"/>
          <xsl:param name="test"/>
          <xsl:param name="subject"/>
          <xsl:param name="diagnostics"/>
          <!-- unused parameters: icon -->
          <assert>
              <xsl:if test="$role">
                  <role><xsl:value-of select="$role" /></role>
              </xsl:if>
              <xsl:if test="$id">
                  <id><xsl:value-of select="$role" /></id>
              </xsl:if>
              <test><xsl:value-of select="$test" /></test>
              <result><xsl:apply-templates mode="text" /></result>
              <xsl:if test="$subject">
                  <subject><xsl:value-of select="$subject" /></subject>
              </xsl:if>
              <xsl:if test="$diagnostics">
                  <diagnostics>
                      <xsl:call-template name="diagnosticsSplit">
                          <xsl:with-param name="str" select="$diagnostics" />
                      </xsl:call-template>
                  </diagnostics>
              </xsl:if>
          </assert>
      </xsl:template>
  
        <!-- override additional templates as needed -->
      <xsl:template name="process-report">
          <xsl:param name="role"/>
          <xsl:param name="test"/>
          <xsl:param name="id"/>
          <xsl:param name="subject"/>
          <xsl:param name="diagnostics"/>
          <!-- unused parameters: icon -->
          <report>
              <xsl:if test="$role">
                  <role><xsl:value-of select="$role" /></role>
              </xsl:if>
              <xsl:if test="$id">
                  <id><xsl:value-of select="$role" /></id>
              </xsl:if>
              <test><xsl:value-of select="$test" /></test>
              <result><xsl:apply-templates mode="text" /></result>
              <xsl:if test="$subject">
                  <subject><xsl:value-of select="$subject" /></subject>
              </xsl:if>
              <xsl:if test="$diagnostics">
                  <diagnostics>
                      <xsl:call-template name="diagnosticsSplit">
                          <xsl:with-param name="str" select="$diagnostics" />
                      </xsl:call-template>
                  </diagnostics>
              </xsl:if>
          </report>
      </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/transformParamExample2.jelly
  
  Index: transformParamExample2.jelly
  ===================================================================
  <?xml version="1.0"?>
  <j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml">
  
      <x:parse var="xsl_doc">
          <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
            <xsl:param name="param1" select="'default value 1'"/>
            <xsl:param name="param2" select="'default value 2'"/>
            <xsl:template match="doc">
              <out><xsl:value-of select="$param1"/><xsl:value-of select="$param2"/></out>
            </xsl:template>
          </xsl:stylesheet>
      </x:parse>
  
    <x:transform xslt="${xsl_doc}" var="doc">
      <doc>Hello</doc>
      <x:param name="param1" value="It "/>
      <x:param name="param2">works!</x:param>
    </x:transform>
  
    <x:expr select="$doc/out"/>
  
  </j:jelly>
  
  
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/transformExampleAllInLine.jelly
  
  Index: transformExampleAllInLine.jelly
  ===================================================================
  <?xml version="1.0"?>
  <j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml">
  
    <x:parse var="xsl_doc">
                  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  
        <xsl:template match="document">
          <html>
            <xsl:apply-templates/>
            <body></body>
          </html>
        </xsl:template>
  
        <xsl:template match="chapter">
          <title><xsl:apply-templates/></title>
        </xsl:template>
  
      </xsl:stylesheet>
          </x:parse>
  
    <x:transform xslt="${xsl_doc}" var="doc" >
      <document>
        <chapter>It works!</chapter>
      </document>
    </x:transform>
  
    <x:expr select="$doc/html/title"/>
  
  </j:jelly>
  
  
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/transformExampleSAXOutputNestedTransforms.jelly
  
  Index: transformExampleSAXOutputNestedTransforms.jelly
  ===================================================================
  <?xml version="1.0"?>
  <j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml" xmlns:log="jelly:log">
  
    <x:transform xslt="transformExample5.xsl" var="doc">
        <x:transform xslt="transformExample4.xsl">
          <x:transform xslt="transformExample3.xsl">
              <x:transform xslt="transformExample2.xsl">
                  <x:transform xslt="transformExample1.xsl">
                      <document>
                        <chapter>It works!</chapter>
                      </document>
                  </x:transform>
              </x:transform>
          </x:transform>
        </x:transform>
    </x:transform>
  
    <x:expr select="$doc/data5/data5_title"/>
  
  </j:jelly>
  
  
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/transformExampleXmlVar.xml
  
  Index: transformExampleXmlVar.xml
  ===================================================================
  <?xml version="1.0"?>
      <document>
        <chapter>It works!</chapter>
      </document>
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/transformExampleXmlVar.jelly
  
  Index: transformExampleXmlVar.jelly
  ===================================================================
  <?xml version="1.0"?>
  <j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml">
  
    <x:transform xslt="transformExample.xsl" xml="transformExampleXmlVar.xml" var="doc"/>
  
    <x:expr select="$doc/html/title"/>
  
  </j:jelly>
  
  
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/transformExample5.xsl
  
  Index: transformExample5.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  
  <xsl:template match="data4">
  <data5>
    <xsl:apply-templates/>
    <data5_body></data5_body>
  </data5>
  </xsl:template>
  
  <xsl:template match="data4_title">
  <data5_title><xsl:apply-templates/></data5_title>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/TestXMLTags.java
  
  Index: TestXMLTags.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/TestXMLTags.java,v 1.1 2003/01/15 23:46:37 dion Exp $
   * $Revision: 1.1 $
   * $Date: 2003/01/15 23:46:37 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * $Id: TestXMLTags.java,v 1.1 2003/01/15 23:46:37 dion Exp $
   */
  package org.apache.commons.jelly.tags.xml;
  
  import java.io.File;
  import java.io.FileInputStream;
  import java.io.InputStream;
  import java.io.StringWriter;
  import java.util.Iterator;
  import java.util.List;
  
  import junit.framework.Test;
  import junit.framework.TestCase;
  import junit.framework.TestSuite;
  import junit.textui.TestRunner;
  
  import org.apache.commons.jelly.JellyContext;
  import org.apache.commons.jelly.Script;
  import org.apache.commons.jelly.XMLOutput;
  import org.apache.commons.jelly.parser.XMLParser;
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  import org.dom4j.Document;
  import org.dom4j.DocumentHelper;
  import org.dom4j.Node;
  
  /** Tests the parser, the engine and the XML tags
    *
    * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
    * @version $Revision: 1.1 $
    */
  public class TestXMLTags extends TestCase {
  
      /** The Log to which logging calls will be made. */
      private static final Log log = LogFactory.getLog(TestXMLTags.class);
      
      /** basedir for test source */
      private static final String testBaseDir ="src/test/org/apache/commons/jelly/tags/xml";
  
      public static void main(String[] args) {
          TestRunner.run(suite());
      }
  
      public static Test suite() {
          return new TestSuite(TestXMLTags.class);
      }
  
      public TestXMLTags(String testName) {
          super(testName);
      }
  
      public void testUnitTests() throws Exception {
          runUnitTest( testBaseDir + "/testForEach.jelly" );
      }
  
      public void testExpressions() throws Exception {
          runUnitTest( testBaseDir + "/testExpressions.jelly");
      }
  
      public void testParse() throws Exception {
          InputStream in = new FileInputStream(testBaseDir + "/example.jelly");
          XMLParser parser = new XMLParser();
          Script script = parser.parse(in);
          script = script.compile();
          log.debug("Found: " + script);
          assertTrue("Parsed a Script", script instanceof Script);
          StringWriter buffer = new StringWriter();
          script.run(parser.getContext(), XMLOutput.createXMLOutput(buffer));
          String text = buffer.toString().trim();
          if (log.isDebugEnabled()) {
              log.debug("Evaluated script as...");
              log.debug(text);
          }
          assertEquals("Produces the correct output", "It works!", text);
      }
  
      public void testTransform() throws Exception {
          String text = evaluteScriptAsText(testBaseDir + "/transformExample.jelly");
          assertEquals("Produces the correct output", "It works!", text);
      }
  
      public void testTransformAllInLine() throws Exception {
          String text = evaluteScriptAsText(testBaseDir + "/transformExampleAllInLine.jelly");
          assertEquals("Produces the correct output", "It works!", text);
      }
  
      public void testTransformParams() throws Exception {
          String text = evaluteScriptAsText(testBaseDir + "/transformParamExample.jelly");
          assertEquals("Produces the correct output", "It works!", text);
      }
  
      public void testTransformParamsInLine() throws Exception {
  
          String text = evaluteScriptAsText(testBaseDir + "/transformParamExample2.jelly");
          assertEquals("Produces the correct output", "It works!", text);
      }
  
      public void testTransformSAXOutput() throws Exception {
          String text = evaluteScriptAsText(testBaseDir + "/transformExampleSAXOutput.jelly");
          assertEquals("Produces the correct output", "It works!", text);
      }
  
      public void testTransformSAXOutputNestedTransforms() throws Exception {
          String text = evaluteScriptAsText(testBaseDir + 
              "/transformExampleSAXOutputNestedTransforms.jelly");
          assertEquals("Produces the correct output", "It works!", text);
      }
  
      public void testTransformSchematron() throws Exception {
          String text = evaluteScriptAsText(testBaseDir + 
              "/schematron/transformSchematronExample.jelly");
          assertEquals("Produces the correct output", "Report count=1:assert count=2", text);
      }
  
      public void testTransformXmlVar() throws Exception {
          String text = evaluteScriptAsText(testBaseDir + 
              "/transformExampleXmlVar.jelly");
          assertEquals("Produces the correct output", "It works!", text);
      }
  
      public void testDoctype() throws Exception {
          String text = evaluteScriptAsText(testBaseDir + 
              "/testDoctype.jelly");
          assertEquals("Produces the correct output", "<!DOCTYPE foo PUBLIC \"publicID\" \"foo.dtd\">\n<foo></foo>", text);
      }
  
      public void runUnitTest(String name) throws Exception {
          Document document = parseUnitTest(name);
  
          List failures = document.selectNodes( "/*/fail" );
          for ( Iterator iter = failures.iterator(); iter.hasNext(); ) {
              Node node = (Node) iter.next();
              fail( node.getStringValue() );
          }
      }
  
      public Document parseUnitTest(String name) throws Exception {
          // parse script
          InputStream in = new FileInputStream(name);
          XMLParser parser = new XMLParser();
          Script script = parser.parse(in);
          script = script.compile();
          assertTrue("Parsed a Script", script instanceof Script);
          StringWriter buffer = new StringWriter();
          script.run(parser.getContext(), XMLOutput.createXMLOutput(buffer));
  
          String text = buffer.toString().trim();
          if (log.isDebugEnabled()) {
              log.debug("Evaluated script as...");
              log.debug(text);
          }
  
          // now lets parse the output
          return DocumentHelper.parseText( text );
      }
  
      /**
       * Evaluates the script by the given file name and
       * returns the whitespace trimmed output as text
       */
      protected String evaluteScriptAsText(String fileName) throws Exception {
          JellyContext context = new JellyContext();
  
          // allow scripts to refer to any resource inside this project
          // using an absolute URI like /src/test/org/apache/foo.xml
          context.setRootURL(new File(".").toURL());
  
          // cature the output
          StringWriter buffer = new StringWriter();
          XMLOutput output = XMLOutput.createXMLOutput(buffer);
  
          context.runScript( new File(fileName), output );
          String text = buffer.toString().trim();
          if (log.isDebugEnabled()) {
              log.debug("Evaluated script as...");
              log.debug(text);
          }
          return text;
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/TestJelly.java
  
  Index: TestJelly.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/TestJelly.java,v 1.1 2003/01/15 23:46:37 dion Exp $
   * $Revision: 1.1 $
   * $Date: 2003/01/15 23:46:37 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   * 
   * $Id: TestJelly.java,v 1.1 2003/01/15 23:46:37 dion Exp $
   */
  package org.apache.commons.jelly.tags.xml;
  
  import junit.framework.TestSuite;
  import junit.textui.TestRunner;
  
  import org.apache.commons.jelly.tags.junit.JellyTestSuite;
  
  /** 
   * A helper class to run jelly test cases as part of Ant's JUnit tests
   *
   * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
   * @version $Revision: 1.1 $
   */
  public class TestJelly extends JellyTestSuite {
  
      public static void main( String[] args ) throws Exception {
          TestRunner.run( suite() );
      }
      
      public static TestSuite suite() throws Exception {
          return createTestSuite(TestJelly.class, "suite.jelly");        
      }
  }
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/transformParamExample.xsl
  
  Index: transformParamExample.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:param name="param1" select="'default value'"/>
    <xsl:template match="doc">
      <out><xsl:value-of select="$param1"/></out>
    </xsl:template>
  </xsl:stylesheet>
  
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/suite.jelly
  
  Index: suite.jelly
  ===================================================================
  <?xml version="1.0"?>
  <test:suite 
  	xmlns:j="jelly:core" 
  	xmlns:x="jelly:xml" 
  	xmlns:test="jelly:junit" 
  	xmlns:log="jelly:log">
  
  	<test:case name="testUriParse">
  		<x:parse var="doc" xml="dummy.xml"/>
  		
  		<test:assert xpath="$doc/dummy/entry[@id='2']"/>		
  	</test:case>
  	
    <test:case name="testElementAndAttribute">
    	
    	<x:parse var="doc">
    		<x:element name="foo">
    			<x:attribute name="x">1234</x:attribute>
    			
    			<x:element name="bar">
  					<x:attribute name="y">ABC</x:attribute>
  					hello
  				</x:element>
    		</x:element>
    	</x:parse>
  	
  		<test:assert xpath="$doc/foo"/>
  		<test:assert xpath="$doc/foo[@x='1234']"/>
  		<test:assert xpath="count($doc/bar) = 0"/>
  
  		<!-- test nested element and attributes -->		
  		<test:assert xpath="$doc/foo[@x='1234']/bar[@y='ABC']"/>
  		<test:assert xpath="$doc/foo[@x='1234']/bar[@y='ABC']='hello'"/>
    </test:case>
    
    <test:case name="testBadElementAndAttribute">
  
  		<log:info>
  			<j:catch var="ex">
  				<x:element name="foo">
  					some text
  					<x:attribute name="x">1234</x:attribute>
  				</x:element>
  			</j:catch>    	
  		</log:info>  	
  		
  		<test:assert test="${ex != null}">
  			We should have created an exception as some text is output before the attributes
  		</test:assert>
    </test:case>
    
    <test:case name="assertXPathTests">
    
      <x:parse var="doc">
        <foo>
        	<bar>cheese</bar>
        </foo>
      </x:parse>  
       
    
      <test:assert xpath="$doc/foo/bar">This should never fail</test:assert>
      <test:assert xpath="$doc/foo/bar = 'cheese'">This should never fail</test:assert>
      
      <j:catch var="ex">
  		  <test:assert xpath="$doc/foo/xyz">This should always fail</test:assert>
  		</j:catch>    	
  		
  		<test:assert test="${ex != null}">We should have created an exception</test:assert>
  		
  		<log:info>The exception was: ${ex.message}</log:info>
    </test:case>
  
  	<!-- test the use of namespaces with XPath -->
    <test:case name="assertXPathWithNamespaceTests" xmlns:a="fooURI" xmlns:z="doesNotMatch" xmlns="different">
    
      <x:parse var="doc">
        <foo xmlns="fooURI">
        	<bar>cheese</bar>
        </foo>
      </x:parse>  
       
      <test:assert xpath="$doc/a:foo/a:bar">This should never fail</test:assert>
      <test:assert xpath="$doc/b:foo/b:bar" xmlns:b="fooURI">This should never fail</test:assert>
      
      <j:catch var="ex">
  		  <test:assert xpath="$doc/z:foo/z:bar">This should always fail</test:assert>
  		</j:catch>    	
  		
  		<test:assert test="${ex != null}">We should have created an exception</test:assert>
  		
      <j:catch var="ex">
  		  <test:assert xpath="$doc/foo/bar">This should always fail, since foo is not in the empty namespace</test:assert>
  		</j:catch>    	
  		
  		<test:assert test="${ex != null}">We should have created an exception</test:assert>
  		
  		<!-- 
  			|| now lets test that the default namespace 'different' is ignored by the XPath expressions
  			|| since XPath should ignore the default namespace - you must use a prefix in XPath to denote
  			|| a namespace
  			-->
  		<test:assert xpath="$doc/*[local-name()='foo']"/>
    </test:case>
  
      <!-- test xpath sorting -->
      <test:case name="testXpathSorting">
          <x:parse var="nums">
              <a>
                  <b v="3"/>
                  <b v="2"/>
                  <b v="1"/>
                  <b v="11"/>
                  <b v="1.4"/>
                  <b v="1.2"/>
              </a>
          </x:parse>
  
          <x:parse var="deeper">
              <a>
                  <b><c><d>3<e>1</e></d></c></b>
                  <b><c><d>2<e>11</e></d></c></b>
                  <b><c><d>1</d></c></b>
                  <b><c><d>11</d></c></b>
              </a>
          </x:parse>
  
          <!-- test ascending -->
          <j:set var="result" value=""/>
          <x:forEach select="$nums/a/b" var="x" sort="number(@v)">
              <x:set var="num" select="$x/@v"/>
              <j:set var="result" value="${result} ${num.get(0).getText()}"/>
          </x:forEach>
  
          <test:assertEquals expected=" 1 1.2 1.4 2 3 11" actual="${result}"/>
  
          <!-- test descending -->
          <j:set var="result" value=""/>
          <x:forEach select="$nums/a/b" var="x" sort="number(@v)" descending="true">
              <x:set var="num" select="$x/@v"/>
              <j:set var="result" value="${result} ${num.get(0).getText()}"/>
          </x:forEach>
  
          <test:assertEquals expected=" 11 3 2 1.4 1.2 1" actual="${result}"/>
  
          <!-- test deeper nesting -->
          <j:set var="result" value=""/>
          <x:forEach select="$deeper/a/b" var="x" sort="number(c/d/text())">
              <j:set var="result" value="${result} ${x.getStringValue()}"/>
          </x:forEach>
  
          <test:assertEquals expected=" 1 211 31 11" actual="${result}"/>
  
          <!-- test sort as strings -->
          <j:set var="result" value=""/>
          <x:forEach select="$nums/a/b" var="x" sort="@v">
              <x:set var="num" select="$x/@v"/>
              <j:set var="result" value="${result} ${num.get(0).getText()}"/>
          </x:forEach>
  
          <test:assertEquals expected=" 1 1.2 1.4 11 2 3" actual="${result}"/>
  
          <!-- test x:set with sort -->
          <j:set var="result" value=""/>
          <x:set var="rset" select="$nums/a/b" sort="number(@v)"/>
          <j:forEach var="num" items="${rset.iterator()}">
              <j:set var="result" value="${result} ${num.attributeValue('v')}"/>
          </j:forEach>
  
          <test:assertEquals expected=" 1 1.2 1.4 2 3 11" actual="${result}"/>
  
          <!-- test x:set with sort -->
          <j:set var="result" value=""/>
          <x:set var="rset" select="$nums/a/b"/>
          <x:sort list="${rset}" sort="number(@v)"/>
          <j:forEach var="num" items="${rset.iterator()}">
              <j:set var="result" value="${result} ${num.attributeValue('v')}"/>
          </j:forEach>
  
          <test:assertEquals expected=" 1 1.2 1.4 2 3 11" actual="${result}"/>
  
      </test:case>
  
  
    <test:case name="testComment">
    	
    	<x:parse var="doc">
    		<foo>
  				<!-- this will not be output -->
  				
  				<x:comment text="this is a comment"/>
    		</foo>
    	</x:parse>
  	
  		<test:assert xpath="$doc/foo"/>
  
  		<j:set var="t"><x:copyOf select="$doc/foo/comment()"/></j:set>
  		
  		<test:assertEquals expected="&lt;!--this is a comment--&gt;" actual="${t.trim()}"/>
  
  	</test:case>
  
    <test:case name="testCommentWithTextAttribute">
    	
    	<x:parse var="doc">
    		<foo>
  				<!-- this will not be output -->
  				
  				<x:comment text="this is a comment"/>
    		</foo>
    	</x:parse>
  	
  		<test:assert xpath="$doc/foo"/>
  
  		<j:set var="t"><x:copyOf select="$doc/foo/comment()"/></j:set>
  		
  		<test:assertEquals expected="&lt;!--this is a comment--&gt;" actual="${t.trim()}"/>
    </test:case>
    
  
  </test:suite>
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/example.jelly
  
  Index: example.jelly
  ===================================================================
  <?xml version="1.0"?>
  <j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml">
  
    <x:parse var="doc">
      <html>
        <title>It works!</title>
        <body>
        </body>
      </html>
    </x:parse>
  
    <x:expr select="$doc/html/title"/>
  
  </j:jelly>
  
  
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/transformExample4.xsl
  
  Index: transformExample4.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  
  <xsl:template match="data3">
  <data4>
    <xsl:apply-templates/>
    <data4_body></data4_body>
  </data4>
  </xsl:template>
  
  <xsl:template match="data3_title">
  <data4_title><xsl:apply-templates/></data4_title>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/transformParamExample.xml
  
  Index: transformParamExample.xml
  ===================================================================
  <?xml version="1.0"?>
  <doc>Hello</doc>
  
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/testExpressions.jelly
  
  Index: testExpressions.jelly
  ===================================================================
  <?xml version="1.0"?>
  <j:jelly trim="false" xmlns:j="jelly:core">
  <testcase>
  	
    <j:set var="topping">cheese</j:set>
    <j:set var="base">deep pan</j:set>
  
    <j:set var="test" value="pizza has ${topping} on top"/>
    
    <j:if test="${test != 'pizza has cheese on top'}">
    	<fail>attribute test failed. Found <j:expr value="${test}"/> and expected 'pizza has cheese on top'</fail>
    </j:if>
    	
    <j:set var="test">pizza has ${topping} on top</j:set>
    
    <j:if test="${test != 'pizza has cheese on top'}">
    	<fail>element test failed. Found <j:expr value="${test}"/> and expected 'pizza has cheese on top'</fail>
    </j:if>
    	
  </testcase>
  </j:jelly>
  
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/transformExample1.xsl
  
  Index: transformExample1.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  
  <xsl:template match="document">
  <data1>
    <xsl:apply-templates/>
    <data1_body></data1_body>
  </data1>
  </xsl:template>
  
  <xsl:template match="chapter">
  <data1_title><xsl:apply-templates/></data1_title>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/transformExample3.xsl
  
  Index: transformExample3.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  
  <xsl:template match="data2">
  <data3>
    <xsl:apply-templates/>
    <data3_body></data3_body>
  </data3>
  </xsl:template>
  
  <xsl:template match="data2_title">
  <data3_title><xsl:apply-templates/></data3_title>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/testDoctype.jelly
  
  Index: testDoctype.jelly
  ===================================================================
  <?xml version="1.0"?>
  <j:jelly trim="false" xmlns:j="jelly:core" xmlns:x="jelly:xml">
  
  <x:doctype name="foo" publicId="publicID" systemId="foo.dtd"/>
  <foo/>
  
  </j:jelly>
  
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/testForEach.jelly
  
  Index: testForEach.jelly
  ===================================================================
  <?xml version="1.0"?>
  <j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml">
  
  <testcase>
  
    <x:parse var="doc">
  
      <a>
        <b v="1"/>
        <b v="2"/>
        <b v="3"/>
      </a>
    </x:parse>
  
    <j:set var="i" value="0"/>
    <j:set var="i2" value="0"/>
      
    <x:forEach select="$doc/a/b" var="x">
      <x:set var="i2" select="$i2 + number($x/@v)"/>
    </x:forEach>
      
    <x:forEach select="$doc/a">
        <x:forEach select="b">
        <x:set var="i" select="$i + @v"/>
      </x:forEach>
    </x:forEach>
    
    <x:if select="$i2 != 6.0">          
        <fail>The i2 should be 6! but the value is <x:expr select="$i2"/></fail>
    </x:if>
    
    <x:if select="$i != 6.0">          
        <fail>The i should be 6! but the value is <x:expr select="$i"/></fail>
    </x:if>
    
  </testcase>
  
  </j:jelly>
  
  
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/xpathSortExample.jelly
  
  Index: xpathSortExample.jelly
  ===================================================================
  <?xml version="1.0"?>
  <j:jelly xmlns:j="jelly:core" xmlns:test="jelly:junit" xmlns:x="jelly:xml">
      <x:parse var="nums">
          <a>
              <b v="3"/>
              <b v="2"/>
              <b v="1"/>
              <b v="11"/>
              <b v="1.4"/>
              <b v="1.2"/>
          </a>
      </x:parse>
  
      <x:parse var="strs">
          <a>
              <b v="z"/>
              <b v="g"/>
              <b v="d"/>
              <b v="a"/>
          </a>
      </x:parse>
  
      <x:parse var="deeper">
          <a>
              <b><c><d>3<e>1</e></d></c></b>
              <b><c><d>2<e>11</e></d></c></b>
              <b><c><d>1</d></c></b>
              <b><c><d>11</d></c></b>
          </a>
      </x:parse>
  
      <j:set var="result" value=""/>
      <x:forEach select="$nums/a/b" var="x" sort="@v">
          <x:set var="num" select="$x/@v"/>
          <j:set var="result" value="${result} ${num.get(0).getText()}"/>
      </x:forEach>
      ${result}
  
      <j:set var="result" value=""/>
      <x:forEach select="$nums/a/b" var="x" sort="@v" descending="true">
          <x:set var="num" select="$x/@v"/>
          <j:set var="result" value="${result} ${num.get(0).getText()}"/>
      </x:forEach>
      ${result}
  
      <j:set var="result" value=""/>
      <x:forEach select="$nums/a/b" var="x" sort="@v" sortDataType="java.lang.String">
          <x:set var="num" select="$x/@v"/>
          <j:set var="result" value="${result} ${num.get(0).getText()}"/>
      </x:forEach>
      ${result}
  
      <j:set var="result" value=""/>
      <x:forEach select="$strs/a/b" var="x" sort="@v">
          <x:set var="str" select="$x/@v"/>
          <j:set var="result" value="${result} ${str.get(0).getText()}"/>
      </x:forEach>
      ${result}
  
      <j:set var="result" value=""/>
      <x:forEach select="$deeper/a/b" var="x" sort="c/d">
          <j:set var="result" value="${result} ${x.getStringValue()}"/>
      </x:forEach>
      ${result}
  
      <j:set var="result" value=""/>
      <x:set var="rset" select="$nums/a/b" sort="@v"/>
      <j:forEach var="num" items="${rset.iterator()}">
          <j:set var="result" value="${result} ${num.attributeValue('v')}"/>
      </j:forEach>
      ${result}
  
      <j:set var="result" value=""/>
      <x:set var="rset" select="$nums/a/b"/>
      <x:sort list="${rset}" sort="@v"/>
      <j:forEach var="num" items="${rset.iterator()}">
          <j:set var="result" value="${result} ${num.attributeValue('v')}"/>
      </j:forEach>
      ${result}
  
  </j:jelly>
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/dummy.xml
  
  Index: dummy.xml
  ===================================================================
  <?xml version="1.0"?>
  <dummy>
    <entry id="1">This is some sample XML</entry>
    <entry id="2">And some more XML</entry>
    <empty/>
  </dummy>  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/transformExample2.xsl
  
  Index: transformExample2.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  
  <xsl:template match="data1">
  <data2>
    <xsl:apply-templates/>
    <data2_body></data2_body>
  </data2>
  </xsl:template>
  
  <xsl:template match="data1_title">
  <data2_title><xsl:apply-templates/></data2_title>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/transformExampleSAXOutput.jelly
  
  Index: transformExampleSAXOutput.jelly
  ===================================================================
  <?xml version="1.0"?>
  <j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml">
  
    <x:parse var="xsl_doc">
                  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  
        <xsl:template match="document">
          <html>
            <xsl:apply-templates/>
            <body></body>
          </html>
        </xsl:template>
  
        <xsl:template match="chapter">
          <title><xsl:apply-templates/></title>
        </xsl:template>
  
      </xsl:stylesheet>
          </x:parse>
  
          <!-- here we're testing if the output of the XSLT comes out as SAX events
                  || that the <x:parse> tag can then parse.
                  || We're using the <x:parse> around the <x:transform> purely to test
                  || that the <x:transform> is capable of outputting SAX events -->
          <x:parse var="doc">             
            <x:transform xslt="${xsl_doc}">
              <document>
                <chapter>It works!</chapter>
              </document>
            </x:transform>
          </x:parse>      
          
    <x:expr select="$doc/html/title"/>
  
  </j:jelly>
  
  
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/transformExample.jelly
  
  Index: transformExample.jelly
  ===================================================================
  <?xml version="1.0"?>
  <j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml">
  
    <x:transform xslt="transformExample.xsl" var="doc" >
      <document>
        <chapter>It works!</chapter>
      </document>
    </x:transform>
  
    <x:expr select="$doc/html/title"/>
  
  </j:jelly>
  
  
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/filesetExample.jelly
  
  Index: filesetExample.jelly
  ===================================================================
  <?xml version="1.0"?>
  <j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml" xmlns="jelly:ant">
  
  	<fileScanner var="scanner">
  		<fileset dir="src/test/org/apache/commons/jelly/xml" includes="**/*.xml"/>
  	</fileScanner>
  	
  	<j:forEach var="file" items="${scanner.iterator()}">
  	    <j:set var="fileFullName" value="${file.name}"/>
  	    <j:set var="fileName" value="${fileFullName.substring(0, fileFullName.length() - 4)}"/>
  		About to process file ${file} and generate file name ${fileName}.html
  
  		<j:file name="target/${fileName}.html">
  			<x:transform xml="${file}" xslt="transformExample.xsl">
  				<x:param name="filename" value="${file.canonicalPath}"/>
  			</x:transform>
  		</j:file>
  	</j:forEach>
  
  </j:jelly>
  
  
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/transformExample.xsl
  
  Index: transformExample.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  
  <xsl:template match="document">
    <html>
      <xsl:apply-templates/>
      <body></body>
    </html>
  </xsl:template>
  
  <xsl:template match="chapter">
    <title><xsl:apply-templates/></title>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/transformParamExample.jelly
  
  Index: transformParamExample.jelly
  ===================================================================
  <?xml version="1.0"?>
  <j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml">
  
    <x:transform xslt="transformParamExample.xsl" var="doc" xml="transformParamExample.xml">
      <x:param name="param1" value="It works!"/>
    </x:transform>
  
    <x:expr select="$doc/out"/>
  
  </j:jelly>
  
  
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/maven.xml
  
  Index: maven.xml
  ===================================================================
  <project default="java:jar">
  
  </project>
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/project.xml
  
  Index: project.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE project [
    <!-- see file for description -->
    <!ENTITY commonDeps SYSTEM "file:../../commonDependencies.ent">
  ]>
  <project>
    <extend>../tag-project.xml</extend>
    <id>commons-jelly-tags-xml</id>
    <name>commons-jelly-tags-xml</name>
  
    <package>org.apache.commons.jelly.tags.xml</package>
  
    <description>
    	 The Jelly XML Tag Library
    </description>
    <shortDescription>Commons Jelly XML Tag Library</shortDescription>
    
    <url>http://jakarta.apache.org/commons/sandbox/jelly/tags/xml/</url>
  
    <siteDirectory>/www/jakarta.apache.org/commons/sandbox/jelly/xml/</siteDirectory>
    <distributionDirectory>/www/jakarta.apache.org/builds/jakarta-commons-sandbox/jelly/tags/xml</distributionDirectory>
    <repository>
      <connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:jakarta-commons-sandbox/jelly/jelly-tags/xml/</connection>
      <url>http://cvs.apache.org/viewcvs/jakarta-commons-sandbox/jelly/jelly-tags/xml/</url>
    </repository>
    
    <dependencies>
    
      &commonDeps;
    
      <!-- START for compilation -->
    
      <dependency>
        <id>commons-jelly</id>
        <version>SNAPSHOT</version>
      </dependency>
        
      <!-- END for compilation -->
      
      <!-- run time / in testing-->
      <dependency>
        <id>xalan</id>
        <version>2.3.1</version>
      </dependency>
          
    </dependencies>
    
  </project>
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  target
  maven.log
  
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/project.properties
  
  Index: project.properties
  ===================================================================
  # -------------------------------------------------------------------
  # P R O J E C T  P R O P E R T I E S
  # -------------------------------------------------------------------
  
  maven.junit.fork=true
  
  maven.compile.deprecation = on
  
  # Installation dir
  maven.dist.install.dir = /usr/local/jelly
  
  maven.checkstyle.properties=../tag-checkstyle.properties
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/betwixt/input.xml
  
  Index: input.xml
  ===================================================================
  <?xml version="1.0"?>
  <transactionBean
    className="org.zenplex.tambora.transaction.PO"
    primitiveTypes="attributes"
    rootName="PO">
  
    <fields>
      <field name="id" type="int"/>
      <field name="name" type="String"/>
    </fields>
  </transactionBean>
  
  
  1.1                  jakarta-commons-sandbox/jelly/jelly-tags/xml/src/test/org/apache/commons/jelly/tags/xml/betwixt/makeBetwixt.jelly
  
  Index: makeBetwixt.jelly
  ===================================================================
  <?xml version="1.0"?>
  <j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml">
  
  <x:parse xml="${inputFile}" var="doc"/>
  <x:set var="rootElementName" select="string($doc/transactionBean/@rootName)"/>
  
  <info primitiveTypes="element">
    <element name="${rootElementName}">
      <x:forEach select="$doc/transactionBean/fields/field">
        <x:set var="fieldName" select="string(@name)"/>
        <x:set var="fieldType" select="string(@type)"/>
        <element name="${fieldName}" property="${fieldName}"/>
      </x:forEach>
    </element>
  </info>
  </j:jelly>
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message