You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by pa...@apache.org on 2001/08/02 21:44:00 UTC

cvs commit: xml-xalan/test/tests/capi/smoke/smokesubdir grandkids.xml faminc.xsl famimp.xsl

pauldick    01/08/02 12:44:00

  Added:       test/tests/capi/smoke/smokesubdir grandkids.xml faminc.xsl
                        famimp.xsl
  Log:
  Basic smoke test data
  
  Revision  Changes    Path
  1.1                  xml-xalan/test/tests/capi/smoke/smokesubdir/grandkids.xml
  
  Index: grandkids.xml
  ===================================================================
  <?xml version="1.0"?>
  <GrandKids>
  	<gkid>1</gkid>
  	<gkid>2</gkid>
  	<gkid>3</gkid>
  	<gkid>4</gkid>
  	<gkid>5</gkid>
  	<gkid>6</gkid>
  	<gkid>7</gkid>
  	<gkid>8</gkid>
  	<gkid>9</gkid>
  </GrandKids>
  
  
  
  1.1                  xml-xalan/test/tests/capi/smoke/smokesubdir/faminc.xsl
  
  Index: faminc.xsl
  ===================================================================
  <?xml version="1.0"?> 
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  
  <xsl:template name="tree">
     <xsl:param name="Surname" select="Default"/>
  
     <xsl:element name="{$root}">
     <xsl:element name="{substring-after($Surname,'The ')}">
  
         <!-- Start with the Parents.-->
  	   <xsl:element name="Parents">
  	   <xsl:for-each select="Parents/Father | Parents/Mother">
  		  <xsl:element name="{name(.)}">
  		     <xsl:value-of select="."/>
  		  </xsl:element>
  	   </xsl:for-each>
  	   </xsl:element>
  
  	   <!-- Then the Children. -->
         <xsl:element name="Children">
  	   <xsl:attribute name="number">
  	      <xsl:value-of select="count(Children/Child)"/>
  	   </xsl:attribute>
  	   <xsl:for-each select="Children/Child">
  		     <xsl:element name="{Personal_Information/Sex}">
  
  			  <xsl:attribute name="name">
  			     <xsl:value-of select="Basic_Information/Name/@First"/>
  			  </xsl:attribute>
  			  <xsl:choose>
  			  <xsl:when test="Personal_Information/Sex='Male'">
  				<xsl:attribute name="wife">
  					<xsl:value-of select="Personal_Information/Family_Information/Wife/Name/@First"/>
  				</xsl:attribute>
  			  </xsl:when>
  			  <xsl:when test="Personal_Information/Sex='Female'">
  				<xsl:attribute name="husband">
  					<xsl:value-of select="Personal_Information/Family_Information/Husband/Name/@First"/>
  				</xsl:attribute>
  			  </xsl:when>
  			  </xsl:choose>
  
  			  <xsl:attribute name="kids">
  				  <xsl:value-of select="count(Personal_Information/Family_Information/Kids/Kid)"/>
  			  </xsl:attribute>				
  
  			  <xsl:if test="count(Personal_Information/Family_Information/Kids/Kid)">
  			     <xsl:element name="Kids">
  			        <xsl:for-each select="Personal_Information/Family_Information/Kids/Kid">
  			           <xsl:element name="Grandkid"><xsl:value-of select="Name/@First"/></xsl:element>
  			        </xsl:for-each>
  			     </xsl:element>
  			  </xsl:if>
  			   
  			  <xsl:value-of select="Basic_Information/Name/@First"/>
  			 </xsl:element>
  	   </xsl:for-each>
  	   </xsl:element>
  
     </xsl:element>
     </xsl:element>
  </xsl:template>
  </xsl:stylesheet>
  
  
  1.1                  xml-xalan/test/tests/capi/smoke/smokesubdir/famimp.xsl
  
  Index: famimp.xsl
  ===================================================================
  <?xml version="1.0"?> 
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  
  
  <xsl:template match="GrandKids" mode="orginal">
  They have <xsl:value-of select="count(*)"/> grandchildren: <xsl:text/>
  	<xsl:for-each select="gkid">
  		<xsl:value-of select="key('KidInfo',(.))/Name/@First"/>
  		<xsl:if test="not(position()=last())">, </xsl:if>
  		<xsl:if test="(position()=last()-1)">and </xsl:if>
  	</xsl:for-each>
  </xsl:template>
  
  <xsl:template match="GrandKids" mode="document">
  They should have <xsl:value-of select="count(document('grandkids.xml')/GrandKids/gkid)"/> grandchildren: <xsl:text/>
  	<xsl:for-each select="gkid">
  		<xsl:value-of select="key('KidInfo',.)/Name/@First"/>
  		<xsl:if test="not(position()=last())">, </xsl:if>
  		<xsl:if test="(position()=last()-1)">and </xsl:if>
  	</xsl:for-each>
  </xsl:template>
  
  <xsl:template match="GrandKids" mode="doc">
  They got <xsl:value-of select="count(document('grandkids.xml')/GrandKids/gkid)"/> grandchildren: <xsl:text/>
  	<xsl:for-each select="document('grandkids.xml')/GrandKids/gkid">
  		<xsl:value-of select="key('KidInfo',(.))/Name/@First"/>
  		<xsl:if test="not(position()=last())">, </xsl:if>
  		<xsl:if test="(position()=last()-1)">and </xsl:if>
  	</xsl:for-each>
  </xsl:template>
  
  </xsl:stylesheet>
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org