[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Finding and promoting footnotes

Subject: Finding and promoting footnotes
From: "Trevor Nicholls" <trevor@xxxxxxxxxxxxxxxxxx>
Date: Wed, 30 Nov 2005 16:35:03 +1300
xml footnotes
Hi

I have a set of input documents which contain footnote elements at the very
end of the document with forward references in <A> elements at the points in
the document where they are relevant. I am trying to refactor these
documents and one of the necessary changes is to "promote" the footnote so
that its content is local to the item which references it.

A typical input XML file will have pieces like these:

------------------------------------------
a. at various points in the document:
  <ROW>
  <TD>
  <Cell>Format<A href="#id(abcdefg)" xml:link="simple"
    show="replace" actuate="user"
    CLASS="footnote">1</A>
  </Cell>
  </TD>
  ...
  </ROW>

b. and at the end of the document:
  <FOOTNOTES>
  <FOOTNOTE>
  <TableFootnote>
  <A ID="abcdefg"></A>
  Assuming standard configuration is selected.</TableFootnote>
  </FOOTNOTE>
  <FOOTNOTE>
  <TableFootnote>
  <A ID="hijklmn"></A>
  Assuming jiggery pokery configuration has been set.</TableFootnote>
  </FOOTNOTE>
  ...
  </FOOTNOTES>
------------------------------------------

I am attempting to merge the footnotes into the body of the document, giving
something like the following result:

------------------------------------------
  <ROW>
  <TD>
  <Cell>Format
  <footnote>Assuming standard configuration is selected.</footnote>
  </Cell>
  </TD>
  ...
  </ROW>
------------------------------------------

My XSL templates include:

------------------------------------------
<!-- Footnotes -->
<xsl:template match="A[@CLASS='footnote']">
<xsl:variable name="fnr"><xsl:value-of select="substring-after(@href,'(')"
/></xsl:variable>
<xsl:variable name="fid"><xsl:value-of select="substring-before($fnr,')')"
/></xsl:variable>
<xsl:apply-templates select="/XML/FOOTNOTES" mode="body" />
</xsl:template>

<xsl:template match="FOOTNOTES: mode="body">
<xsl:for-each select="FOOTNOTE">
<xsl:if test="*/A[@ID={$fid}]">
<footnote>Test footnote matching: <xsl:apply-templates /></footnote>
</xsl:if>
</xsl:for-each>
</xsl:template>

<xsl:template match="FOOTNOTES"></xsl:template>
------------------------------------------

It's the test immediately before <footnote>..</footnote> that is giving me
trouble. What is the recommended way to process this so that the content of
the single FOOTNOTE which contains an <A ID="x"> which matches the document
body's <A href="id(x)"> is output here?

This could well be an FAQ but if so, not under the keywords I tried!

Thanks in advance
Trevor

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.