xslt - XML Document with Chapters and Footnotes -


i new xml programing. created xml file holds data , xsl file transform it. creates html file simple document has title, chapters, paragraphs,and footnotes. not want footnotes appear after each chapter footnotes chapter. cannot figure out how that, please help. here xsl:

<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet  version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:fo="http://www.w3.org/1999/xsl/form">                 <xsl:output method="html" version="3.0" omit-xml-declaration="yes" indent="no" />                 <xsl:param name="notes" select="'true'" />                     <xsl:template match="/collection">                         <html>                             <head>                                         <style>                                                 {text-decoration:none;}                                                 a.tooltip {outline:none; }                                                               a.tooltip strong {line-height:30px;}                                                  a.tooltip:hover {text-decoration:bold;}                                                  a.tooltip span { z-index:10;display:none; padding:14px 20px; margin-top:-30px; margin-left:28px; width:300px; line-height:16px; }                                                  a.tooltip:hover span{ display:inline; position:absolute; color:#111; border:1px solid #dca; background:#fffaf0;}                                                  .callout {z-index:20;position:absolute;top:30px;border:0;left:-12px;}                                                  a.tooltip span { border-radius:4px; box-shadow: 5px 5px 8px #ccc; }                                                                          .seriestitle {font-family: arial,univers,sans-serif; font-size: 24pt;text-align: center; }                                             .chaptertitle {font-family: arial,univers,sans-serif; font-size: 14pt ;text-align: left;}                                             .booktitle {font-family: arial,univers,sans-serif; font-size: 14pt ;text-align: left;}                                         </style>                                  </head>                             <body>                                  <xsl:apply-templates select="series"/>                             </body>                         </html>                     </xsl:template>                  <xsl:template match="series">                                 <div class="seriestitle"><xsl:value-of select="title"/></div>                                 <xsl:apply-templates select="seriesintroduction"/>                                 <xsl:apply-templates select="book"/>                 </xsl:template>                        <xsl:template match="seriesintroduction">                                 <p><xsl:apply-templates select="introcontent"/></p>                 </xsl:template>                  <xsl:template match="book">                                 <p class="booktitle"><xsl:value-of select="title"/> </p>                                 <xsl:apply-templates select="introduction"/>                                 <xsl:apply-templates select="chapter"/>                  </xsl:template>                   <xsl:template match="introduction">                                 <p><b><xsl:value-of select="title"/></b></p>                                 <xsl:apply-templates select="introcontent"/>                 </xsl:template>                  <xsl:template match="chapter">                                 <p  class="chaptertitle"><xsl:value-of select="@chaptertitle"/>: <xsl:value-of select="chaptertitle"/></p>                                 <xsl:apply-templates select="chaptercontent"/>                  </xsl:template>                  <xsl:template match="chaptercontent">                                 <p><xsl:apply-templates/></p>                                 <xsl:apply-templates select="//footnote" mode="fulltext"  />                  </xsl:template>                  <xsl:template match="footnote">                                  <a>                                                 <xsl:attribute name="class">                                                                <xsl:text>tooltip</xsl:text>                                                   </xsl:attribute>                                                                                <xsl:attribute name="name">                                                                <xsl:text>footnoteref</xsl:text><xsl:number level="single" count="footnote" format="1"/>                                                   </xsl:attribute>                                                   <xsl:attribute name="href">                                                                 <xsl:text>#footnote</xsl:text><xsl:number level="single" count="footnote" format="1"/>                                                 </xsl:attribute>                                               <sup><xsl:number level="single" count="footnote" format="1"/></sup>                                               <span><xsl:value-of select="@notetext"/></span>                                  </a>                 </xsl:template>                   <xsl:template match="footnote" mode="fulltext">                                 <p>                                                 <a>                                                                  <xsl:attribute name="name">                                                                                 <xsl:text>footnote</xsl:text><xsl:number level="single" count="footnote" format="1"/>                                                                   </xsl:attribute>                                                                 <xsl:attribute name="href">                                                                                     <xsl:text>#footnoteref</xsl:text><xsl:number level="single" count="footnote" format="1"/>                                                                 </xsl:attribute>                                                                 <sup><xsl:number level="single" count="footnote" format="1"/> </sup>                                                  </a>                                                 <xsl:value-of select="@notetext"/>                                 </p>                 </xsl:template>              </xsl:stylesheet> 

here xml:

<?xml version="1.0" encoding="utf-8"?> <!-- new document created editix @ fri mar 27 12:23:38 edt 2015 --> <?xml-stylesheet type="text/xsl" href="crossreferencecollection.xsl"?> <collection>   <series>     <title>the apostolic fathers, justin martyr, irenaeus</title>     <seriesintroduction>       <introcontent>         <para>           <word>text removed brevity , clarity.</word>           <word>text removed brevity , clarity.</word>           <word>text removed brevity , clarity.</word>         </para>       </introcontent>       <intronotes></intronotes>     </seriesintroduction>     <book booknumber="1">       <title>first epistle of clement corinthians</title>       <introduction>         <title>introductory note first epistle of clement corinthians</title>         <introcontent>           <para>             <word>text removed brevity , clarity.</word>           </para>           <para>             <word>text removed brevity , clarity.</word>           </para>           <para>             <word>text removed brevity , clarity.</word>           </para>           <para>             <word>text removed brevity , clarity.</word>           </para>           <para>             <word>text removed brevity , clarity.</word>           </para>           <para>             <word>text removed brevity , clarity.</word>           </para>           <para>             <word>text removed brevity , clarity.</word>           </para>           <para>             <word>text removed brevity , clarity.</word>           </para>           <para>             <word>text removed brevity , clarity.</word>           </para>         </introcontent>         <intronotes></intronotes>       </introduction>       <chapter chaptertitle="chapter 1">         <chaptertitle>the salutation. praise of corinthians before breaking forth of schism among them </chaptertitle>         <chaptercontent>           <para>             <word>text removed brevity , clarity.</word>             <word>owing, dear brethren, sudden , successive calamitous events have happened ourselves, feel have been tardy in turning our attention points respecting consulted us; </word>             <footnote label="1" notetext="note fact corinthians asked of brethren,  personal friends of apostle st. paul. clement's own name not appear in epistle."></footnote>             <word> , shameful , detestable sedition, utterly abhorrent elect of god, few rash , self-confident persons have kindled such pitch of frenzy, venerable , illustrious name, worthy universally loved, has suffered grievous injury. </word>             <footnote label="2" notetext="literally, 'is blasphemed.'"></footnote>             <word> ever dwelt short time among you, , did not find faith fruitful of virtue firmly established? </word>             <footnote label="3" notetext="literally, 'did not prove all-virtuous , firm faith.'"></footnote>             <word> did not admire sobriety , moderation of godliness in christ? did not proclaim magnificence of habitual hospitality? , did not rejoice on perfect , well-grounded knowledge? ye did things without respect of persons, , walked in commandments of god, being obedient had rule on you, , giving fitting honour presbyters among you. ye enjoined young men of sober , serious mind; ye instructed wives things blameless, becoming, , pure conscience, loving husbands in duty bound; , ye taught them that, living in rule of obedience, should manage household affairs becomingly, , in every respect marked discretion.</word>           </para>         </chaptercontent>         <notes />       </chapter>       <chapter chaptertitle="chapter 2">         <chaptertitle>praise of corinthians continued.</chaptertitle>         <chaptercontent>           <para>             <word>moreover, ye distinguished humility, , in no respect puffed pride, yielded obedience rather extorted it,</word>             <footnote label="1" notetext="ephesians 5:21" crossref="ephesians 5:21"></footnote>             <footnote label="2" notetext="1 peter 5:5" crossref="1 peter 5:5"></footnote>             <word> , more willing give receive.</word>             <footnote label="3" notetext="acts 20:35"></footnote>             <word> content   provision god had made you, , attending words, ye inwardly filled</word>             <footnote label="4" notetext="literally, 'ye embraced in bowels.' [concerning complaints of photius (ninth century) against clement, see bull's defensio fidei nicænæ, works, vol. v. p. 132.]"></footnote>             <word> doctrine, , sufferings before eyes. profound , abundant peace given all, , ye had insatiable desire doing good, while full outpouring of holy spirit upon all. full of   holy designs, ye did, true earnestness of mind , godly confidence, stretch forth hands god almighty, beseeching him merciful unto you, if ye had been guilty of involuntary transgression. day , night ye anxious whole brotherhood,</word>             <footnote label="5" notetext="1 peter 2:17"></footnote>             <word> number of god's elect might saved mercy , conscience.</word>             <footnote label="6" notetext="so, in ms., many have suspected text here corrupt. perhaps best emendation substitutes sunaistheseos, 'compassion,' suneideseos, 'conscience.'"></footnote>             <word> ye sincere , uncorrupted, , forgetful of injuries between 1 another. every kind of faction , schism abominable in sight. ye mourned on transgressions of neighbours: deficiencies deemed own. ye never grudged act of kindness, being "ready every work."</word>             <footnote label="7" notetext="titus 3:1"></footnote>             <word> adorned thoroughly virtuous , religious life, ye did things in fear of god. commandments , ordinances of lord written upon tablets of hearts.</word>             <footnote label="8" notetext="proverbs 7:3"></footnote>             <word></word>           </para>         </chaptercontent>         <notes />       </chapter>     </book>   </series> </collection> 

instead of:

<xsl:apply-templates select="//footnote" mode="fulltext"  /> 

try:

<xsl:apply-templates select=".//footnote" mode="fulltext"  /> 

or (preferably, if hierarchy consistent):

<xsl:apply-templates select="para/footnote" mode="fulltext"  /> 

otherwise selecting all footnotes in entire document, starting root node.


Comments