Re: [xsl] handling tags and PIs within a macro

Subject: Re: [xsl] handling tags and PIs within a macro
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 23 Oct 2007 17:02:06 +0100
> I just need to have dsc right after cmd, and that's
> really important. How can I do that?

The order of the elements in the source does not matter as your template
controls the order that they are processed.


you had



<xsl:template match="j_entry">
<row>
  <entry>
  <xsl:element name="formalpara">
    <xsl:attribute name="id">
      <xsl:value-of select="@fid"/>
     </xsl:attribute>
     <title>
       <xsl:value-of select="@cmd"/>
     </title>
  </xsl:element>

  <formalpara>
    <title>Description</title>
    <xsl:value-of select="@dsc"/>
  </formalpara>

  <formalpara>
    <title>Relevant to</title>
    <xsl:value-of select="@rel"/>
  </formalpara>

  <formalpara>
    <title>Type</title>
    <xsl:value-of select="@t"/>
  </formalpara>
  
  <formalpara>
    <title>Default Value</title>
    <xsl:value-of select="@val"/>
  </formalpara>
  </entry>
</row>
</xsl:template>


So cmd is processed before dsc whatever order they are in the source.

You want to change 

 <xsl:value-of select="@val"/

to 

 <xsl:apply-templates select="val"/>

(note that by mistake I left in the @ in my previous reply)

so something like


<xsl:template match="j_entry">
<row>
  <entry>
  <formalpara id="{fid}"/>
     <title>
       <xsl:apply-templates select="cmd"/>
     </title>
  </formalpara

  <formalpara>
    <title>Description</title>
    <xsl:apply-templates select="dsc"/>
  </formalpara>

  <formalpara>
    <title>Relevant to</title>
    <xsl:apply-templates select="rel"/>
  </formalpara>

  <formalpara>
    <title>Type</title>
    <xsl:apply-templates select="t"/>
  </formalpara>
  
  <formalpara>
    <title>Default Value</title>
    <xsl:apply-templates select="val"/>
  </formalpara>
  </entry>
</row>
</xsl:template>

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________

Current Thread