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/src/test/org/apache/commons/jelly/jsl suite.jelly
Date Wed, 20 Nov 2002 05:54:11 GMT
dion        2002/11/19 21:54:11

  Modified:    jelly/src/test/org/apache/commons/jelly/jsl suite.jelly
  Log:
  Added test case to show xmloutput context being lost using apply templates
  
  Revision  Changes    Path
  1.6       +24 -7     jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/jsl/suite.jelly
  
  Index: suite.jelly
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/jsl/suite.jelly,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- suite.jelly	19 Nov 2002 13:28:43 -0000	1.5
  +++ suite.jelly	20 Nov 2002 05:54:11 -0000	1.6
  @@ -24,20 +24,17 @@
           <jsl:template match="document" trim="no">
   
             <h>
  -            <!-- uncomment this to fix the bug </h> -->
  -
               <j:set var="full"><x:expr select="$doc/document/properties/title"/></j:set>
               <j:set var="short"><x:expr select="./properties/title" /></j:set>
               <m:echo>full=${full},short=${short}</m:echo>
               <test:assert test="${full == short}">All iterations should succeed</test:assert>
  -            <!-- comment this out to fix the bug -->
             </h>
           </jsl:template>
         </jsl:stylesheet>
   
       </j:forEach>
   
  -    <!-- this one works!! -->
  +    <!-- test stylesheet external to loop -->
       <jsl:stylesheet var="ss1">
         <jsl:template match="document" trim="no">
           <h>
  @@ -71,13 +68,10 @@
       <jsl:stylesheet var="myStylesheet">
       	<jsl:template match="document" trim="no">
       		<h>
  -        <!-- uncomment this to fix the bug </h> -->
  -
           <j:set var="full"><x:expr select="$doc/document/properties/title"/></j:set>
           <j:set var="short"><x:expr select="./properties/title" /></j:set>
           <m:echo>full=${full},short=${short}</m:echo>
           <test:assert test="${full == short}">All iterations should succeed</test:assert>
  -        <!-- comment this out to fix the bug -->
       		</h>
       	</jsl:template>
       </jsl:stylesheet>
  @@ -139,4 +133,27 @@
   		</j:forEach>  	
   		
     </test:case>  
  +  
  +  <!-- 
  +    test case to test that the xml output for a stylesheet template is
  +    'remembered' when using applyTemplates
  +   -->
  +  <test:case name="testXMLContextKept" xmlns="dummy">
  +    <x:parse var="testDoc">
  +      <element1>
  +         <element2>SomeText</element2>
  +      </element1>
  +    </x:parse>
  +    
  +    <jsl:stylesheet var="contextStyleSheet">
  +      <jsl:template match="element1">
  +        <j:set var="contextText">El1<jsl:applyTemplates /></j:set>
  +      </jsl:template>
  +      <jsl:template match="element2"><x:expr select="."/></jsl:template>
  +    </jsl:stylesheet>
  +
  +    <jsl:style stylesheet="${contextStyleSheet}" select="$testDoc"/>
  +    <m:echo>text is '${contextTest}'</m:echo>
  +    <test:assertEquals expected="El1SomeText" actual="${contextText}" />
  +  </test:case>
   </test:suite>
  
  
  

--
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