xsl-list
[Top] [All Lists]

RE: XSL selection question

2002-11-06 07:14:51
Sorry,
      The e-mail width did not do the output justice. Let's try that a
different way.

output as this,

<part-number> <Desc.> <View>  <Note Title> <Note Desc>
                      <View>  <Note Title> <Note Desc>

The first 2 cells in the second table row are empty, but their
corresponding tags must be output. This is due to the relationship between
the view -> note title -> note description to the part number ->
description. There may also be instances where I have multiple note/note
desc pairs or multiple note descriptions for a note title for a specific
view. I also need to be able to handle these, but I am having difficulty
finding and information on this. Performing these actions in XSL to HTML
transformation is relatively easy, but I have, as yet, had difficulty
getting the same logic to work in XSL-FO.

A push in the right direction is appreciated though.

thanks,
Jeremy

---Andrew Welch wrote:
Hi,

You need to just apply-templates in document order, so in english you
might say

for each <inst-part>
 output <part-number>
 output <description>
 output <inst-notes>

at the moment you are saying

for each <inst-note>
 output <part-number>
 output <description>
 output content...

so naturally enough you will get the <part-number> and <description>
output every time you encounter an <inst-note>.

Rearrange your templates a little and then apply them in document order
(if your dtd allows)

(untested)

<xsl:template match="inst-part">
 <!-- format the part number and description -->
 <!-- It is not that easy with FO -->
 <xsl:apply-templates/>
</xsl:template>

<xsl:template match="part-number">
 <fo:table-row line-height="10pt">
   <fo:table-cell padding="4pt">
     <fo:block text-align="start">
       <xsl:value-of select="."/>
     </fo:block>
   </fo:table-cell>
 <fo:table-cell padding="4pt" height="1cm">
</xsl:template>

<xsl:template match="description">
 <fo:table-cell padding="4pt" height="1cm">
   <fo:block text-align="start">
     <xsl:value-of select="."/>
   </fo:block>
 </fo:table-cell>
</xsl:template>


<xsl:template match="inst-note">
     <!-- format the output of the "view" value along -->
     <!-- with the note contents. This will not start -->
     <!-- at the beginning of the line.               -->

     <!--....part-number and description handling code separated out-->


     <fo:table-cell padding="4pt" height="1cm">
       <fo:block text-align="center">
        <xsl:value-of select="view"/>
     .....

cheers
andrew





 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>