xsl-list
[Top] [All Lists]

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

2007-10-23 09:10:27
Thanks for your help, David! 

I am testing the suggested template.

Regards,
Nancy

--- David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk> wrote:



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. 

________________________________________________________________________


--~------------------------------------------------------------------
XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to:
http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--