Re: [docbook-apps] Gentext for performance="optional"?

From
<>
Date
2013-04-08T23:08:21+00:00
ID
Thread
Re: [docbook-apps] Gentext for performance="optional"?
Eric,

I use a template that placed a "checkbox" in front of the procedure step. 
You probably could adapt this template to do what you need.

 

Regards,

Dean Nelson

 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet 
[
<!ENTITY CHECKBOX1 "&#x2610;"> <!-- white square 
-->
<!ENTITY CHECKBOX2 "&#x2611;"> <!-- white square with 
check in it-->
<!ENTITY CHECKBOX3 "&#x25A1;"> <!-- white 
square -->
<!ENTITY CHECKBOX4 "&#x25A2;"> <!-- white square 
with rounded corners -->
<!ENTITY CHECKBOX5 "&#x2B1A;"> <!-- 
large white square -->
<!ENTITY CHECKBOX6 "&#x25EF;"> <!-- 
white circle -->
<!ENTITY CHECKBOXSQ "[ ]"> <!-- brackets 
-->
]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
version="1.0"
  xmlns:fo="http://www.w3.org/1999/XSL/Format" 
>

 

   <!-- This template places a checkbox before each step in a 
procedure 
        if the procedure has a 
role="check" attribute. If the procedure 
also
        has a step with a 
role="nocheck" that step will be rendered without a 

        
checkbox.
        

        This is only accomplished if the 
parameter "met.procedure.checkbox" is not empty.
   
-->
    <xsl:param 
name="met.procedure.checkbox">1</xsl:param>
    
<xsl:param 
name="met.procedure.checkbox.type">&CHECKBOX1;</xsl:param>
    
<xsl:param name="met.procedure.checkbox.size">100%</xsl:param>

 

  <xsl:template 
match="procedure[@role='check']//step">
    
<xsl:variable name="id">
      
<xsl:call-template name="object.id"/>
    
</xsl:variable>
    
    
<fo:list-item  
xsl:use-attribute-sets="list.item.spacing">
      
<fo:list-item-label end-indent="label-end()">
  <fo:block 
id="{$id}">
          
<xsl:choose>
            
<xsl:when test="count(../step) = 
1">
              
<xsl:text>&#x2022;</xsl:text>
            
</xsl:when>
            
<xsl:otherwise>
              
<xsl:choose>
                
<xsl:when test="$met.procedure.checkbox != '' and 
not(@role='nocheck')">
                  
<fo:block font-weight="bold" margin-left="-0.5cm" 
>
     <fo:inline vertical-align="middle" 
font-size="{$met.procedure.checkbox.size}">
      <xsl:value-of 
select="$met.procedure.checkbox.type"/>
     </fo:inline>
                    
<xsl:apply-templates select="." 
mode="number">
                      
<xsl:with-param name="recursive" 
select="0"/>
                    
</xsl:apply-templates>.</fo:block>
                
</xsl:when>
                
<xsl:otherwise>
                  
<xsl:apply-templates select="." 
mode="number">
                    
<xsl:with-param name="recursive" 
select="0"/>
                  
</xsl:apply-templates>. 
</xsl:otherwise>
              
</xsl:choose>
            
</xsl:otherwise>
          
</xsl:choose>
        
</fo:block>
      
</fo:list-item-label>
      
<fo:list-item-body 
start-indent="body-start()">
        
<fo:block>
          
<xsl:apply-templates/>
        
</fo:block>
      
</fo:list-item-body>
    </fo:list-item>
  
</xsl:template>

</xsl:stylesheet>

 

 

 

 

In a message dated 4/8/2013 2:22:04 P.M. Pacific Daylight Time, 
 writes:

  

  
Hello docbook-apps. I’ve been beating my head against the 
  wall for a while on this one now and I’m hoping I can get a quick answer 
  here.

  
 

  
I have some procedural steps that have the 
  performance=”optional” attribute on them, and I want to have some generated 
  text such as “(Optional) “ to appear before the step text so readers know that 
  the step is optional. I can’t find anything anywhere regarding the styling of 
  step in this fashion. Any ideas? I’m hoping there is a parameter I can set to 
  make it easy, otherwise I can customize a template to insert the text based on 
  an if statement.

  
 

  
How do you guys do this?

  
 

  
Eric Nordlund

  
Customer 
  Documentation and Training

  
Cray 
  Inc.

  
901 5th 
  Ave

  
Seattle, WA 
  98164

  
(206)701-2232