Subject: [xsl] Get the element to original position XSLT 1.0 From: pankaj.c@xxxxxxxxxxxxxxxxxx Date: Mon, 31 Jan 2011 13:26:50 +0530 |
Hello all, I've a requirement wherein I am moving all the text footnotes to endnotes, which I done in the following manner: <chapter> <section> <p>XXXX <footnote id="fn0010"><label>1</label><p>footnote 1</p></footnote> XXXX</p> <p>XXXX <footnote id="fn0015"><label>1</label><p>footnote 2</p></footnote> XXXX</p> <p>XXXX <footnote id="fn0020"><label>1</label><p>footnote 3</p></footnote> XXXX</p> <p>XXXX <footnote id="fn0025"><label>1</label><p>footnote 3</p></footnote> XXXX</p> -------- -------------- </section> </chapter> I've been able to move all my footnotes at the end as below, while keeping the flag (comment <footnote> elements) for reverting bak to orininal xml <chapter> <p>XXXX <!--<footnote id="fn0010">--> XXXX</p> <p>XXXX <!--<footnote id="fn0015">--> XXXX</p> <p>XXXX <!--<footnote id="fn0020">--> XXXX</p> <p>XXXX <!--<footnote id="fn0025">--> XXXX</p> <footnote id="fn0010"><label>1</label><p>footnote 1</p></footnote> <footnote id="fn0015"><label>1</label><p>footnote 2</p></footnote> <footnote id="fn0020"><label>1</label><p>footnote 3</p></footnote> <footnote id="fn0025"><label>1</label><p>footnote 4</p></footnote> </chapter> All is well and fine till now, but now I am bit struggling with re-transforming back. I understand that I need to match @id of commented text <footnote> with the moved <footnote id="fn0010"> to get at the right position. <xsl:template match="comment()"> <xsl:choose> <xsl:when test="substring(.,2,8)='footnote'"> <!-- do something here --> </xsl:when> <xsl:otherwise> <xsl:comment><xsl:value-of select="."/></xsl:comment> </xsl:otherwise> </xsl:choose> </xsl:template> Anybody can throw some idea to get it done. I am definitely missing something. TIA, Pankaj
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Re: Using position() to retri, John Brown | Thread | Re: [xsl] Get the element to origin, Piet van Oostrum |
[xsl] Re: Using position() to retri, John Brown | Date | Re: [xsl] Get the element to origin, Piet van Oostrum |
Month |