Hi Isabel,
Generally using xsl:value-of on an element with complex content won't give you 
satisfactory results.  A xsl:value-of will extract only the text, and not 
process any internal child elements.  Taking xsl:value-of for the title will 
work if the title has only text, but if it has a subscript, the subscript 
formatting will not be applied.  As you found, an inline image is an empty 
element and so does not contribute to the text string.

One approach that I use is to use xsl:apply-templates, but not on the element 
itself but on the child nodes of the element.  Using node() in the select will 
select all child nodes, including text nodes, elements, processing 
instructions, and comments.  For example:

<xsl:apply-templates select="title/node()"/>

or 

<xsl:apply-templates select="step/node()"/>

That approach avoids generating the container of the original element, allowing 
you to put the content in your own container.

Bob Stayton
Sagehill Enterprises
[EMAIL PROTECTED]


  ----- Original Message ----- 
  From: isabel.hofherr 
  To: [email protected] 
  Sent: Tuesday, July 08, 2008 5:39 AM
  Subject: [docbook-apps] WG: customization of single step procedures


  Sorry - I have copied the code from an old file. That's the one, which works 
fine:

   

  .

  <xsl:choose>

                                                                 <xsl:when 
test="count(step) = 1">

                                                                                
<table border="0">

                        <tr>

                          <td><font face="Arial, Helvetica, sans-serif"><b>

                                                                                
                <xsl:text>&#x25ba;</xsl:text><xsl:value-of 
select="procedure|title"/><xsl:text>, </xsl:text></b></font>

                                                                                
                <font size="2" face="Arial, Helvetica, sans-serif">

                                                                                
                <xsl:value-of 

                                                                                
                                               select="child::step"/>

                                                                                
                </font></td>

                          </tr>

                                                                                
</table>

                                                                 </xsl:when>

                                                                 <xsl:otherwise>

  .

   

   

  Von: isabel.hofherr [mailto:[EMAIL PROTECTED] 
  Gesendet: Dienstag, 8. Juli 2008 14:26
  An: [email protected]
  Betreff: customization of single step procedures

   

  Hi, 

   

  I have the problem that we have to customize the look of single step 
procedures in *.chm output  (single and multi step procedures always have the 
same look with an arrow in front of the title.)

  The title of the single step procedure should be in line with the text of the 
"single" step.

  That's what I did so far to customize it:

   

  <xsl:template match="procedure">

  .

  .

  .

  <xsl:choose>

                                                 <xsl:when test="count(step) = 
1">

                                                             <table border="0">

                        <tr>

                          <td><font face="Arial, Helvetica, sans-serif"><b>

                                                                         
<xsl:text>&#x25ba;</xsl:text><xsl:value-of 
select="procedure|title"/><xsl:text>, </xsl:text></b></font>

                                                                         <font 
size="2" face="Arial, Helvetica, sans-serif">

                                                                         
<xsl:apply-templates 

                                                                                
                select="step

                                                                                
    |comment()[preceding-sibling::step]

                                                                                
    |processing-instruction()[preceding-sibling::step]"/>

                                                                         
</font></td>

                          </tr>

                                                             </table>

                                                 </xsl:when>

                                                 <xsl:otherwise>

  ..

  ..

   

   

  And it worked! 

   

  But now we have the next request: sometimes inline graphics are required 
within the step description. And I have no idea how to manage the correct 
display. What approach I have to choose?

  I would appreciate any help.

   

  Thanks

  Isabel

   

   

Reply via email to