OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

legalxml-econtracts message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Caption Numbers


Jason said:
>To recap what i put in my FAQ document, i think it is highly desirable
>to have a clause model which has one and only one thing at each level in
>the hierachy.  As soon as you depart from this, not only do you make
>things needlessly complex for the user, but for stylesheet purposes, you
>can't infer the level of something (and therefore how to number it) from
>its name (eg Section).

Hmm, it seems easy to specify formatting in a CSS stylesheet for markup of the
flexibility that I support:

<style type='text/css'>
Contract * {margin-left:0em}
Contract Paragraph {margin-left:0em}
Contract Article {margin-left:0em}
Contract Section {margin-left:0em}
Contract Article Section (margin-left:2em}
Contract Article Paragraph {margin-left:2em}
Contract Article Section Paragraph {margin-left:4em}
</style>

Here's the corresponding XSL match conditions; within these templates, one can
generate caption numbers without too much problem.

<xsl:template match='*[parent::Contract]'>
<xsl:template match='Paragraph[parent::Contract]'>
<xsl:template match='Article[parent::Contract]'>
<xsl:template match='Section[parent::Contract]'>
<xsl:template match='Section[parent::Article[parent::Contract]]'>
<xsl:template match='Paragraph[parent::Article[parent::Contract]]'>
<xsl:template
match='Paragraph[parent::Section[parent::Article[parent::Contract]]]'>

Actualy, in a default case, I might key off the presence of a Caption, Title, or
similar element to determine if a caption number is to be generated.

<xsl:template match='Caption[not(sibling::CaptionNumber) and
not(child::CaptionNumber)]'>
   <xsl:if test='normalize-space(.)!=""'>
       <xsl:variable name='Caption.Number.text'>
	<xsl:call-template name='Block.Caption.Number.text'>
                      <xsl:with-param name='Block' select='parent::*'/>
               </xsl:call-template>
       </xsl:variable>
       <xsl:if test='normalize-space($Caption.Number.text)!=""'>
           <span class='BlockNumber' names='Caption.Number.text'>
               <xsl:value-of select='normalize-space($Caption.Number.text')/>
           </span>
           <xsl:text> </xsl:text>
       </xsl:if>
       <span class='BlockTitle' names='Caption.text'>
           <xsl:value-of select='normalize-space(.)'/>
       </span>
   </xsl:if>
</xsl:template>
<xsl:template name='Block.Caption.Number.text'>
<xsl:param name='Block'/>
   <xsl:variable name='myNumber'
            select='string(count(preceding-sibling::*[Caption])+1)'/>
   <xsl:choose>
   <xsl:when test='ancestor::*[Caption]'>
       <xsl:variable name='rootNbr'>
           <xsl:call-template name='Caption.Number.text'>
              <xsl:with-param name='Block' select='ancestor::*[Caption]'/>
           </xsl:call-template>
       </xsl:variable>
       <xsl:value-of select='$rootNbr'/>.<xsl:value-of select='$myNumber'/>
   </xsl:when>
   <xsl:otherwise><xsl:value-of select='$myNumber'/></xsl:otherwise>
   </xsl:choose>
</xsl:template>

As a disclaimer, I haven't tested any of the above code, but it's probably not
far off.

Jason, I am not sure whether, for a user, it is more complex or not for them to
select markup-names (when using an editor that expose a DTD) that do not
correspond to their own vocabulary.... to me, one important objective of
sotware, indeed of a standard vocabulary, is to accommodate the needs of users,
rather than forcing users to accommodate the needs of computers.
John McClure



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]