Attachment 'customized-content_xsl_fromJesse_012511.xsl'

Download

   1 <?xml version="1.0" encoding="utf-8"?>
   2 <xsl:stylesheet version="1.0" xmlns="http://www.w3.org/1999/xhtml" 
   3                               xmlns:html="http://www.w3.org/1999/xhtml" 
   4                               xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   5                               xmlns:wwmode="urn:WebWorks-Engine-Mode"
   6                               xmlns:wwdoc="urn:WebWorks-Document-Schema"
   7                               xmlns:wwsplits="urn:WebWorks-Engine-Splits-Schema"
   8                               xmlns:wwimaging="urn:WebWorks-XSLT-Extension-Imaging"
   9                               xmlns:wwlog="urn:WebWorks-XSLT-Extension-Log"
  10                               xmlns:wwuri="urn:WebWorks-XSLT-Extension-URI"
  11                               xmlns:wwfilesystem="urn:WebWorks-XSLT-Extension-FileSystem"
  12                               xmlns:wwprojext="urn:WebWorks-XSLT-Extension-Project"
  13                               xmlns:wwtoc="urn:WebWorks-Engine-TOC-Schema"
  14                               exclude-result-prefixes="html xsl wwmode wwdoc wwsplits wwimaging wwlog wwuri wwprojext wwfilesystem wwtoc"
  15 >
  16   <xsl:import href="wwtransform:super" />
  17 
  18   <!-- Begin Customization -->
  19   <!-- Equation fix to enable right-aligned equation numbers.
  20   Received from Jesse Wiles for 2011-01-12 Study Hall session via WebWorks wiki page:
  21   http://wiki.webworks.com/DevCenter/Projects/EquationOverrides2009.3Later/Discussion
  22   (customized version of this file attached to page in Equations-fromJesse-011210.zip)
  23   -->
  24   <xsl:template match="wwdoc:Paragraph[@stylename = 'Equations w/number, catalog' or @stylename = 'Equations w/number 1, catalog']" mode="wwmode:content">
  25     <xsl:param name="ParamParagraph" select="." />
  26     <xsl:param name="ParamSplits"/>
  27     <xsl:param name="ParamSplit"/>
  28 
  29     <html:table style="width: 100%;">
  30       <html:tr>
  31         <html:td style="padding-left: 5%; text-align: left;">
  32           <xsl:for-each select="$ParamParagraph/wwdoc:TextRun">
  33             <xsl:for-each select="wwdoc:Frame | wwdoc:Text">
  34               <xsl:variable name="VarItem" select="." />
  35               <xsl:choose>
  36                 <xsl:when test="local-name() = 'Frame'">
  37                   <xsl:for-each select="$ParamSplits[1]">
  38                     <xsl:variable name="VarSplitsFrame" select="key('wwsplits-frames-by-id', $VarItem/@id)[@documentID = $ParamSplit/@documentID]" />
  39                     <xsl:variable name="VarImageInfo" select="wwimaging:GetInfo($VarSplitsFrame/@path)" />
  40      
  41                     <xsl:variable name="VarSrc" select="wwuri:GetRelativeTo($VarImageInfo/@path, $ParamSplit/@path)" />
  42                     <html:img src="{$VarSrc}" class="EquationGraphic" style="border: 0px; vertical-align: baseline;" />
  43                   </xsl:for-each>
  44                 </xsl:when>
  45 
  46                 <xsl:otherwise>
  47                   <html:span><xsl:value-of select="@value" /></html:span>
  48                 </xsl:otherwise>
  49               </xsl:choose>
  50             </xsl:for-each>
  51           </xsl:for-each>
  52         </html:td>  
  53 
  54         <!-- Second cell with fixed width -->
  55         <!--                                 -->
  56         <html:td style="padding-right: 20px; text-align: right;">
  57           <xsl:for-each select="$ParamParagraph/wwdoc:Number">
  58             <html:div style="font-weight: bold; font-size: large;">
  59               <xsl:for-each select="descendant::wwdoc:Text">
  60                 <xsl:value-of select="@value" />
  61               </xsl:for-each>
  62             </html:div>
  63           </xsl:for-each>
  64         </html:td>
  65       </html:tr>
  66     </html:table>
  67   </xsl:template>
  68   <!-- End Customization -->
  69   
  70   
  71   <!-- Override default MiniTOC template -->
  72   
  73   <xsl:template name="MiniTOC">
  74    <xsl:param name="ParamSplit" />
  75    <xsl:param name="ParamTOCEntry" />
  76    <xsl:param name="ParamEmitTOCEntry" />
  77    <xsl:param name="ParamMiniTOCSubLevels" />
  78 
  79    <xsl:if test="($ParamEmitTOCEntry = true()) or (count($ParamTOCEntry/wwtoc:Entry[1]) = 1)">
  80     <html:div class="WebWorks_MiniTOC">
  81 
  82      <!-- [rofish 2007-04-05] -->  
  83      <!-- [VPI customization] -->
  84      <!-- [http://wiki.webworks.com/HelpCenter/Tips/AddingHeadingsToMiniTOCs] -->
  85      <html:div class="MiniTOCHeading">
  86       In this section:
  87      </html:div>
  88      <!-- [END customization] -->
  89 
  90      <!-- Emit top-level entry? -->
  91      <!--                       -->
  92      <xsl:choose>
  93       <xsl:when test="$ParamEmitTOCEntry = true()">
  94        <html:div class="WebWorks_MiniTOC_Level1">
  95         <!-- Paragraph -->
  96         <!--           -->
  97         <xsl:call-template name="MiniTOCParagraph">
  98          <xsl:with-param name="ParamParagraph" select="$ParamTOCEntry/wwdoc:Paragraph" />
  99         </xsl:call-template>
 100        </html:div>
 101 
 102        <!-- Children -->
 103        <!--          -->
 104        <xsl:call-template name="MiniTOCEntries">
 105         <xsl:with-param name="ParamReferencePath" select="$ParamSplit/@path" />
 106         <xsl:with-param name="ParamParent" select="$ParamTOCEntry" />
 107         <xsl:with-param name="ParamMiniTOCSubLevels" select="$ParamMiniTOCSubLevels" />
 108         <xsl:with-param name="ParamLevel" select="2" />
 109        </xsl:call-template>
 110       </xsl:when>
 111 
 112       <xsl:otherwise>
 113        <!-- Children -->
 114        <!--          -->
 115        <xsl:call-template name="MiniTOCEntries">
 116         <xsl:with-param name="ParamReferencePath" select="$ParamSplit/@path" />
 117         <xsl:with-param name="ParamParent" select="$ParamTOCEntry" />
 118         <xsl:with-param name="ParamMiniTOCSubLevels" select="$ParamMiniTOCSubLevels" />
 119         <xsl:with-param name="ParamLevel" select="1" />
 120        </xsl:call-template>
 121       </xsl:otherwise>
 122      </xsl:choose>
 123     </html:div>
 124    </xsl:if>
 125   </xsl:template>
 126   
 127 </xsl:stylesheet>

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2011-01-12 18:47:46, 29.3 KB) [[attachment:Equations-fromJesse-011210.zip]]
  • [get | view] (2011-01-25 13:22:39, 1.7 KB) [[attachment:customized-content.xsl.zip]]
  • [get | view] (2011-01-25 14:52:57, 5.7 KB) [[attachment:customized-content_xsl_fromJesse_012511.xsl]]
 All files | Selected Files: delete move to page

You are not allowed to attach a file to this page.