Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 7th, 2014, 03:18 PM
Authorized User
 
Join Date: Apr 2013
Posts: 31
Thanks: 3
Thanked 0 Times in 0 Posts
Default match different instances

I've the below case in my XML.

Code:
<main>
        <para num="1.12.10">
            since no <page num="138"/>principal.
            <footnoteref linkend="fn855" num="855"/><footnote num="855" id="fn855" number-type="arabic"></footnote>
        </para>
        <para num="1.12.11">
            In other pl<footnoteref linkend="fn857" num="857"/>
            <footnote num="857" id="fn857" number-type="arabic">
            </footnote>short of the fraud of the agent.
            <footnoteref linkend="fn860" num="860"/>
            <footnote num="860" id="fn860" number-type="arabic"></footnote><footnoteref linkend="fn861" num="861"/><footnote num="861" id="fn861" number-type="arabic">
                <para>At [8-209].</para>
            </footnote>
        </para>
        <para num="1.12.12">
            Indeed, in some non-property cases such as
            <footnoteref linkend="fn862" num="862"/>
            <footnote num="862" id="fn862" number-type="arabic">
                <para>
                    <case>[1896] 2 Ch 743</case>.
                </para>
            </footnote>
        </para>
    </main>
and from `footnotes template` I use the below.

Code:
  <xsl:template match="footnote">    
    <xsl:if test="preceding::page[1]">
           <xsl:variable name="op"><</xsl:variable>
        <xsl:variable name="apos">'</xsl:variable>
        <xsl:variable name="cl">></xsl:variable>
        
        <xsl:value-of select="concat($op,'?pb label=',$apos,preceding::page[1]/@num,$apos,'?',$cl)"/>
        
           </xsl:if>
    </xsl:template>
and i get the below output

Code:
    &lt;?pb label='138'?&gt;<div class="tr_footnote">
    				<div class="footnote">
    					<sup>
    						<a name="ftn.855" href="#f855" class="tr_ftn">855</a>
    					</sup>a</div>
    			</div>&lt;?pb label='138'?&gt;<div class="tr_footnote">
    				<div class="footnote">
    					<sup>
    						<a name="ftn.857" href="#f857" class="tr_ftn">857</a>
    					</sup>b</div>
    			</div>&lt;?pb label='138'?&gt;<div class="tr_footnote">
    				<div class="footnote">
    					<sup>
    						<a name="ftn.860" href="#f860" class="tr_ftn">860</a>
    					</sup>c</div>
    			</div>&lt;?pb label='138'?&gt;<div class="tr_footnote">
    				<div class="footnote">
    					<sup>
    						<a name="ftn.861" href="#f861" class="tr_ftn">861</a>
    					</sup>At [8-209].</div>
    			</div>&lt;?pb label='138'?&gt;<div class="tr_footnote">
    				<div class="footnote">
    					<sup>
    						<a name="ftn.862" href="#f862" class="tr_ftn">862</a>
    					</sup>[1896] 2 Ch 743.
                </div>
    			</div>
but i want the output as below.

Code:
    &lt;?pb label='138'?&gt;<div class="tr_footnote">
    				<div class="footnote">
    					<sup>
    						<a name="ftn.855" href="#f855" class="tr_ftn">855</a>
    					</sup>a</div>
    			</div><div class="tr_footnote">
    				<div class="footnote">
    					<sup>
    						<a name="ftn.857" href="#f857" class="tr_ftn">857</a>
    					</sup>b</div>
    			</div><div class="tr_footnote">
    				<div class="footnote">
    					<sup>
    						<a name="ftn.860" href="#f860" class="tr_ftn">860</a>
    					</sup>c</div>
    			</div><div class="tr_footnote">
    				<div class="footnote">
    					<sup>
    						<a name="ftn.861" href="#f861" class="tr_ftn">861</a>
    					</sup>At [8-209].</div>
    			</div><div class="tr_footnote">
    				<div class="footnote">
    					<sup>
    						<a name="ftn.862" href="#f862" class="tr_ftn">862</a>
    					</sup>[1896] 2 Ch 743.
                </div>
    			</div>
i.e. the first footnote following the `page number` should have `pb label` tag, the footnote location can be ignored. i.e. the footnote can be anywhere in the XML but the first footnote following para should get `pb label` tag and rest should be ignored.

please let me know how can i do it.

Thanks





Similar Threads
Thread Thread Starter Forum Replies Last Post
Several instances of the same Mobile Service maca BOOK: Windows Azure Web Sites 0 December 23rd, 2013 04:52 PM
How many Instances are running dash dev C# 2005 7 December 5th, 2007 04:05 PM
template match doesnt match the required node Tomi XSLT 2 March 12th, 2007 06:24 AM
Question on DataSet instances VictorQ BOOK: Beginning C# 2005 Databases 0 January 28th, 2007 11:11 PM
One form in multiple instances. Sink Access VBA 0 June 7th, 2004 04:25 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.