View Single Post
  #2 (permalink)  
Old March 4th, 2008, 10:12 AM
Martin Honnen Martin Honnen is offline
Friend of Wrox
Points: 6,676, Level: 34
Points: 6,676, Level: 34 Points: 6,676, Level: 34 Points: 6,676, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2007
Location: Germany
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

Your samples are not complete so the following stylesheet is not complete either but it shows you how to use modes to process nodes twice:
Code:
<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="1.0"
  xmlns="http://www.w3.org/1999/xhtml"
  xmlns:xforms="http://www.w3.org/2002/xforms">

  <xsl:output method="xml" indent="yes"/>

  <xsl:template match="data">
    <html>
      <head>
        <title>Example</title>
        <xsl:apply-templates select="*" mode="binding"/>
      </head>
      <body>
        <xsl:apply-templates select="*" mode="controls"/>

      </body>
    </html>
  </xsl:template>

  <xsl:template match="data/*" mode="binding">
    <xforms:bind nodeset="{local-name()}" required="true()" type="xs:{@type}"/>
  </xsl:template>

  <xsl:template match="data/*" mode="controls">
    <p>
      <xforms:input ref="{local-name()}">
        <xforms:label><xsl:value-of select="@label"/></xforms:label>
      </xforms:input>
    </p>
  </xsl:template>

</xsl:stylesheet>
Reply With Quote