topical media & game development

talk show tell print

professional-xml-08-language-modes.xsl / xsl



  <?xml version="1.0" encoding="UTF-8"?>
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
          <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
          <xsl:template match="/">
                  <modes>
                          <xsl:apply-templates select="//customer[@id='ANATR']" mode="block" />
                          <xsl:apply-templates select="//customer[@id='ANATR']" mode="attributes" />
                  </modes>
          </xsl:template>
          <xsl:template match="customer" mode="attributes">
                  <attributesMode>
                          <xsl:attribute name="company"><xsl:value-of select="company" /></xsl:attribute>
                          <xsl:attribute name="contact"><xsl:value-of select="contact/name" /></xsl:attribute>
                          <xsl:attribute name="phone"><xsl:value-of select="contact/phone" /></xsl:attribute>
                  </attributesMode>
          </xsl:template>
          <xsl:template match="customer" mode="block">
                  <blockMode>
                          <xsl:value-of select="company"/>: <xsl:value-of select="contact/name" /> (<xsl:value-of select="contact/phone" />)</blockMode>
          </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.