Saxon Template Reference

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • asearle
    New Member
    • Sep 2006
    • 39

    Saxon Template Reference

    Hi everyone,

    I hope this is a simple (syntax) thing and that someone can point me in the right direction.

    At the moment, I am successfully processing an XML file with Saxon (from the command line) and get the output that I expect.

    However, the XSL file that I have 'inherited' contains multiple templates. e.g.

    <xsl:template match="/">
    XSL ... stuff
    </xsl:template>

    <xsl:template name="record">
    More XSL ... stuff
    </xsl:template>

    So far my processing only takes the first template so now I need to know how to get it to process the file using the second template.

    Here is my calling syntax (written all on one line normally) ...

    java -jar saxon9he.jar -t -s:c:\xml\fragme nt.xml -xsl:c:\xml\xsl_ file.xsl -o:c:\xml\fragme nt.txt

    I am sure that all I need to do is to 'plug' in a reference to the named template and indeed the saxon documentation mentions various parameter options but I am not clear about how this is implemented.

    Anyway, I hope that someone has a little tip or a snippet of code for me.

    Regards and thanks,
    Alan
  • jkmyoung
    Recognized Expert Top Contributor
    • Mar 2006
    • 2057

    #2
    What is in your XSL ... stuff ?
    Do you have a <xsl:apply-templates select="record"/> or something like that in the main template?

    Comment

    • asearle
      New Member
      • Sep 2006
      • 39

      #3
      Yes, there is also this in the main template ...

      <xsl:for-each select="xxxFile/Record">
      <xsl:call-template name="record"/>
      </xsl:for-each>

      Which means I am barking up the wrong tree.

      There are differences between the XSL and the XML which is the reason why no records are being returned.

      Your question nudged me in the right direction and now I can investigate further.

      Many thanks,
      Alan

      Comment

      Working...