home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / XML Utilities / Professional Programmer XSL IDE / Xselerator25.msi / Data.Cab / F38448_testStore.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2002-01-20  |  4.0 KB  |  94 lines

  1. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  2. xmlns:saxon="http://icl.com/saxon"
  3. >
  4.  
  5.   <xsl:import href="store.xsl"/>
  6.   
  7.   <!-- to be applied on any xml source -->
  8.   
  9.   <xsl:output method="text"/>  
  10.  
  11.   <xsl:template match="/"> 
  12.     <!-- Get Initial Store -->
  13.     <xsl:variable name="vrtfStore0">
  14.       <xsl:call-template name="getInitialStore"/>
  15.     </xsl:variable>
  16.     
  17.     <xsl:variable name="vStore0" select="saxon:node-set($vrtfStore0)/*"/>
  18.     
  19.     <!-- Get A, B, C from the initial store: must be 0-s -->
  20.       vStore0:
  21.       A='<xsl:apply-templates select="$vStore0/*[local-name() = 'getValue']">
  22.           <xsl:with-param name="pName" select="'A'"/>
  23.          </xsl:apply-templates>'
  24.       B='<xsl:apply-templates select="$vStore0/*[local-name() = 'getValue']">
  25.           <xsl:with-param name="pName" select="'B'"/>
  26.          </xsl:apply-templates>'
  27.       C='<xsl:apply-templates select="$vStore0/*[local-name() = 'getValue']">
  28.           <xsl:with-param name="pName" select="'C'"/>
  29.          </xsl:apply-templates>'
  30.  
  31.     <!-- Update store0 with 'A=1' -->
  32.     <xsl:variable name="vrtfStore1">
  33.       <xsl:apply-templates select="$vStore0/*[local-name() = 'updateStore']">
  34.         <xsl:with-param name="pName" select="'A'"/>
  35.         <xsl:with-param name="pValue" select="1"/>
  36.       </xsl:apply-templates>
  37.     </xsl:variable>
  38.  
  39.     <xsl:variable name="vStore1" select="saxon:node-set($vrtfStore1)/*"/>
  40.     <!-- Get A, B, C from the store1: A is 1, the rest must be 0-s -->
  41.       vStore1:
  42.       A='<xsl:apply-templates select="$vStore1/*[local-name() = 'getValue']">
  43.           <xsl:with-param name="pName" select="'A'"/>
  44.          </xsl:apply-templates>'
  45.       B='<xsl:apply-templates select="$vStore1/*[local-name() = 'getValue']">
  46.            <xsl:with-param name="pName" select="'B'"/>
  47.          </xsl:apply-templates>'
  48.       C='<xsl:apply-templates select="$vStore1/*[local-name() = 'getValue']">
  49.            <xsl:with-param name="pName" select="'C'"/>
  50.          </xsl:apply-templates>'
  51.     
  52.     <!-- Update store1 with 'B=2' -->
  53.     <xsl:variable name="vrtfStore2">
  54.       <xsl:apply-templates select="$vStore1/*[local-name() = 'updateStore']">
  55.         <xsl:with-param name="pName" select="'B'"/>
  56.         <xsl:with-param name="pValue" select="2"/>
  57.       </xsl:apply-templates>
  58.     </xsl:variable>
  59.  
  60.     <xsl:variable name="vStore2" select="saxon:node-set($vrtfStore2)/*"/>
  61.     <!-- Get A, B, C from the store2: A is 1, B is 2, the rest must be 0-s -->
  62.       vStore2:
  63.       A='<xsl:apply-templates select="$vStore2/*[local-name() = 'getValue']">
  64.            <xsl:with-param name="pName" select="'A'"/>
  65.          </xsl:apply-templates>'
  66.       B='<xsl:apply-templates select="$vStore2/*[local-name() = 'getValue']">
  67.            <xsl:with-param name="pName" select="'B'"/>
  68.          </xsl:apply-templates>'
  69.       C='<xsl:apply-templates select="$vStore2/*[local-name() = 'getValue']">
  70.            <xsl:with-param name="pName" select="'C'"/>
  71.          </xsl:apply-templates>'
  72.     
  73.     <!-- Update store2 with 'C=3' -->
  74.     <xsl:variable name="vrtfStore3">
  75.       <xsl:apply-templates select="$vStore2/*[local-name() = 'updateStore']">
  76.         <xsl:with-param name="pName" select="'C'"/>
  77.         <xsl:with-param name="pValue" select="3"/>
  78.       </xsl:apply-templates>
  79.     </xsl:variable>
  80.  
  81.     <xsl:variable name="vStore3" select="saxon:node-set($vrtfStore3)/*"/>
  82.     <!-- Get A, B, C from the store3: A is 1, B is 2, C is 3, the rest must be 0-s -->
  83.       vStore3:
  84.       A='<xsl:apply-templates select="$vStore3/*[local-name() = 'getValue']">
  85.            <xsl:with-param name="pName" select="'A'"/>
  86.          </xsl:apply-templates>'
  87.       B='<xsl:apply-templates select="$vStore3/*[local-name() = 'getValue']">
  88.            <xsl:with-param name="pName" select="'B'"/>
  89.          </xsl:apply-templates>'
  90.       C='<xsl:apply-templates select="$vStore3/*[local-name() = 'getValue']">
  91.            <xsl:with-param name="pName" select="'C'"/>
  92.          </xsl:apply-templates>'
  93.    </xsl:template>
  94. </xsl:stylesheet>