XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition (702 page)

BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition
12.82Mb size Format: txt, pdf, ePub

    

      

      

        



        

          

          

            

              

              

            

            End Notes

          

          


            

                                 mode=“notes”/>

          


        


      

    

  


The main content of the document is produced by the

call that immediately follows the

start tag. This processes the children of the

element, using their respective template rules, and generates the output of each of these children independently. There are generally three children:


,

, and

. The header contains front material such as the status section and abstract, the body contains the numbered sections of the document, and the

element contains the appendices.

I haven't come across a W3C document that uses footnotes or endnotes, which is what the rest of this rule is dealing with. It displays all

elements, other than those found within a


, as endnotes at the end of the document. A couple of comments on this code:

  • The XPath expression
    //footnote[not(ancestor::table)]
    is probably fairly expensive to evaluate, as it involves a scan of the whole document. Because the expression is used twice, it's a natural candidate for a variable.
  • It's possible that the author imagined that

    would cause the following text to be displayed on a new line. In fact, HTML browsers treat a newline character exactly the same as a space. Alternatively, it's possible that the author simply wanted to create some breaks in the HTML to make it usable in a text editor, without having to switch to

    . Either way, it does no harm. (Actually, I've shown the code from the original HTML stylesheet here. The conversion to XHTML has caused the numeric character reference

    to be replaced by a real newline, which upsets the indentation, though it doesn't change the meaning.)

The named template
css
, which is called from the above template rule, looks like this:

  

    

      

code           { font-family: monospace; }

div.constraint,

div.issue,

div.note,

div.notice     { margin-left: 2em; }

ol.enumar      { list-style-type: decimal; }

ol.enumla      { list-style-type: lower-alpha; }

ol.enumlr      { list-style-type: lower-roman; }

ol.enumua      { list-style-type: upper-alpha; }

ol.enumur      { list-style-type: upper-roman; }


      

        

div.exampleInner pre { margin-left: 1em;

                       margin-top: 0em; margin-bottom: 0em}

div.exampleOuter {border: 4px double gray;

                  margin: 0em; padding: 0em}

div.exampleInner { background-color: #d5dee3;

                   border-top-width: 4px;

                   border-top-style: double;

                   border-top-color: #d3d3d3;

                   border-bottom-width: 4px;

                   border-bottom-style: double;

                   border-bottom-color: #d3d3d3;

                   padding: 4px; margin: 0em }

div.exampleWrapper    { margin: 4px }

div.exampleHeader { font-weight: bold;

                    margin: 4px}


      

      

    

    

      

      http://www.w3.org/StyleSheets/TR/

      

        base

        

          

            W3C-WD

            W3C-REC

            W3C-PR

            W3C-CR

            W3C-NOTE

            base

          

        

      

      .css

    

  


This code generates two elements within the HTML

element: a