[xsl] Re: [XSL] Footnotes Display

Subject: [xsl] Re: [XSL] Footnotes Display
From: "Ilya Konanykhin" <ilya.konanykhin.ml@xxxxxxxxx>
Date: Fri, 30 Nov 2007 17:05:47 +0600
Hi, Alice!

Hi,

   I am in the middle of producing something with footnotes of a
particular section. The a tags are produced nicely, but I am having
problems putting the heading around the page.

This is what I have in the XSLT:

    <xsl:template match="to_do">
        <xsl:apply-templates select="list"/>
        <xsl:call-template name="notes"/>
    </xsl:template>

      <xsl:template match="item">
            Some processing list the items
      </xsl:template>

<xsl:template name="notes">
        <div>
            <xsl:choose>
                <xsl:when test="p/@xml:id='authnote'">
                    <h3>Notes</h3>
                    <xsl:apply-templates/>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:apply-templates/>
                </xsl:otherwise>
            </xsl:choose>
        </div>
    </xsl:template>

XML:

   <to_do>
    <item>See the Dentist</item>
    <item>Return Library Book</item>
    <item>Research about XSLT<ref target="authnote">*</ref></item>
    </to_do>
    <p xml:id="authnote">* Check out books on XPath 2.0 and XSLT 2.0 by
Tennison, Kay published by Wrox.</p>

  My plan is that the output for the footnte section in the notes
template would be something like

<h3>Notes</h3>
<p>*  Check out books on XPath 2.0 and XSLT 2.0 by Tennison, Kay
published by Wrox.</p>

However, my current output is that the <h3> tag is placed above the
<xsl:apply-templates/> Can anyone please tell me what I have done wrong
here?

Thanks a lot for your help. I am using XSLT 2.0.

Alice

Alice Wei
School of Library and Information Science
Indiana University Bloomington

I follow the list with lag of several days, but your question seems to stay without answer yet. I don't know whether you've solved this issue, but in case you haven't I'll make a couple of guesses/comments.


First, you have <xsl:apply-templates select="list"/>, but in the input there is no <list> elements under <to_do>, only <item>s. It might be, that <xsl:apply-templates select="list"/> is what you need.

Next, as far as I can see, the actual list items are still being printed since in the named template you have <xsl:apply-templates/> (in both xsl:choose branches), and as the context node is not changed by the named template and it is still <to_do> node, templates matching <item> children do their job.

Third, I hardly can see how did you manage to get <h3>Note</h3>, since XPATH expression in <xsl:when test="p/@xml:id='authnote'"> (which contains the aforementioned H3 tag) checks <p> children of the current node, and in your example input <p xml:id="authnote">...</p> is definetely not among the kids of <to_do>. When I ran the test I got only textual representation of the <p> tag which was even out of <div>...</div> and was obviously going from the default copy template.

The last thing I have to say is that I haven't tested anything of what I said except for this H3 thing so I might be completely mistakening :)

Anyway, hope this will help you.

Cheers,
Ilya


Current Thread