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

Re: Move Text

Subject: Re: Move Text
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 9 Apr 2024 07:13:57 -0000
Re:  Move Text
On 09/04/2024 06:23, Byomokesh Sahoo sahoo.byomokesh@xxxxxxxxx wrote:
Hi,

I am trying to move text to paragraph based on SUP value matching.
Please find the below xml, output xml and xsl.

XML
--------
<body>
B  B  <div id="FNid000">
B  B  <p margin-left="123.25pt">8.3. In
B  B  B  B  <a name="_ftnref1"/>
B  B  B  B  <a href="#_ftn1"><sup>[1]</sup></a>, this analysed different<a
href="#_ftn2"><sup>[2]</sup></a> mean</p>
B  B  </div>
B  B  <div id="FNid001">
B  B  B  B  <p class="FootnoteText"
B  B  B  B  B  B  margin-left="94.95pt">
B  B  B  B  B  B  <sup>[1]</sup> 2001 9 SCC</p>
B  B  </div>
B  B  <div id="FNid002">
B  B  B  B  <p class="FootnoteText"
B  B  B  B  B  B  margin-left="94.95pt">
B  B  B  B  B  B  <sup>[2]</sup><b>2011 3 SCC 626</b>
B  B  B  B  </p>
B  B  </div>

</body>

Expected Output
---------------------------
<body>
B  B  <div id="FNid000">
B  B  <p margin-left="123.25pt">8.3. In
B  B  B  B  <p class="FootnoteText"
B  B  B  B  B  B  margin-left="94.95pt">
B  B  B  B  B  B  <sup>[1]</sup> 2001 9 SCC</p>, this analysed different<p
class="FootnoteText"
B  B  B  B  B  B  margin-left="94.95pt">
B  B  B  B  B  B  <sup>[2]</sup><b>2011 3 SCC 626</b>
B  B  B  B  </p> mean</p>
B  B  </div>
</body>


I think it might work to use a key e.g.


B <xsl:key name="ft" match="div/p[@class = 'FootnoteText']" use="sup"/>


B  <xsl:template match="a[matches(@href, '#_ftn[0-9]+') and sup]">
B B B  <xsl:copy-of select="key('ft', sup)"/>
B  </xsl:template>

B <xsl:template match="div[p[@class = 'FootnoteText']]"/>

B <xsl:mode on-no-match="shallow-copy"/>



That would replace the <a href="#_ftnX"><sup>[X]</sup></a> elements with
the referenced p class="FootnotText".

I haven't been able to figure from the simple example sample why there
is also a <a name="_ftnref1"/> for the first footnote reference but not
for the second. Perhaps add an empty <xsl:template
match="a[matches(@name, '_ftnref[0-9]+')]"/>.

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.