topical media & game development

talk show tell print

professional-xml-04-XMLSpyFiles-ZipCodes.xsl / xsl



  <?xml version="1.0"?>
  <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:fo="http://www.w3.org/1999/XSL/Format">
  
    <xsl:template match="/">
      <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
  
        <fo:layout-master-set>
  
          <fo:simple-page-master 
                          master-name="A4"
                          page-width="29.7cm"
                          page-height="21cm"
                          margin-top="1cm"  
                          margin-bottom="1cm"
              margin-left="1cm" 
              margin-right="1cm">
            <fo:region-body/>
          </fo:simple-page-master>
  
        </fo:layout-master-set>
  
        <fo:page-sequence master-reference="A4">
  
          <fo:flow flow-name="xsl-region-body">
                          <fo:table>
                                  <fo:table-column column-width="3cm"/>
                                  <fo:table-column column-width="3cm"/>
                                  <fo:table-body>
                                          <fo:table-row background-color="silver">
                                                  <fo:table-cell border-style="solid" padding-top="2px" padding-bottom="2px" padding-left="2px" padding-right="2px">
                                                          <fo:block>Postcode</fo:block>
                                                  </fo:table-cell>
                                                  <fo:table-cell border-style="solid" padding-top="2px" padding-bottom="2px" padding-left="2px" padding-right="2px">
                                                          <fo:block>City</fo:block>
                                                  </fo:table-cell>
                                          </fo:table-row>
                                          <xsl:apply-templates select="//ROOT/PostCode">
                                                  <xsl:sort data-type="text" select="City"/>
                                          </xsl:apply-templates>
                                  </fo:table-body>
                          </fo:table>
                  </fo:flow>
          
        </fo:page-sequence>
  
      </fo:root>
    </xsl:template>
  
    <xsl:template match="//ROOT/PostCode">
          <fo:table-row>
                  <fo:table-cell border-style="solid" padding-top="2px" padding-bottom="2px" padding-left="2px" padding-right="2px">
                          <fo:block><xsl:value-of select="PostCode"/></fo:block>
                  </fo:table-cell>
                  <fo:table-cell border-style="solid" padding-top="2px" padding-bottom="2px" padding-left="2px" padding-right="2px">
                          <fo:block><xsl:value-of select="City"/></fo:block>
                  </fo:table-cell>
          </fo:table-row>
    </xsl:template>
  
  </xsl:stylesheet>
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.