Subject: [xsl] Re: [Fwd: Placing ID's when cited] From: Ragulf Pickaxe <ragulf.pickaxe@xxxxxxxxx> Date: Mon, 21 Nov 2005 09:24:59 +0100 |
Hi Aaron, I guess that you want the non-citations first, then the citations. >From the context, I guess that a citation is an a element in the para element. <xsl:template match="sections"> <xsl:apply-templates select="section[not(para/a)]" mode="no-citation"/> <xsl:apply-templates select="section[para/a]" mode=citation"/> </xsl:template> <xsl:template match="section" mode="no-citation"> <xsl:copy> <xsl:copy-of select="*[not(self::bookmark)]"/> </xsl:copy> </xsl:template> <xsl:template match="section" mode="citation"> <xsl:copy> <xsl:attribute name="id">sec<xsl:value-of select="position()"/></xsl:attribute> <xsl:copy-of select="*[not(self::bookmark)]"/> </xsl:copy> </xsl:template> I hope this helps. Regards, Ragulf Pickaxe :-) On 11/18/05, Aaron Apigo <a.apigo@xxxxxxxxxxx> wrote: > > ---------- Forwarded message ---------- > From: Aaron Apigo <a.apigo@xxxxxxxxxxx> > To: > Date: Fri, 18 Nov 2005 13:22:05 +0800 > Subject: Placing ID's when cited > > Hi all, > Can someone help me with this. In my input XML, all sections have their > corresponding bookmarks, these bookmarks id's is used if there is a citation > for that corresponding <section>. Look at my input xml: > > Input: > <root> > <sections> > <section><bookmark id="sec1"/> > <title>Introduction</title> > <para>Data here</para> > </section> > <section><bookmark id="sec2"/> > <title>Methods</title> > <para>Data here <a link="sec4">Conclusions</a> for other > reference.</para> > </section> > <section><bookmark id="sec3"/> > <title>Results</title> > <para>Data here. See <a link="sec2">Methods</a> for other > reference.</para> > </section> > <section><bookmark id="sec4"/> > <title>Conclusions</title> > <para>Data here. See <a link="sec3">Results</a> for other > comment.</para> > </section> > </sections> > </root> > > Hope you understand what I'm trying to explain in my input XML. > The problem is, in my output XML, only those sections that have citations > are the one that should have id's, and since the id's have changed, the > corresponding citations should also be changed. > My idea about this, is to look for the bookmarks that have a citations, then > sort it. Am I correct with that? And can someone show me how to do that. > > Output: > <root> > <sections> > <section> > <title>Introduction</title> > <para>Data here</para> > </section> > <section id="sec1"> > <title>Methods</title> > <para>Data here <a link="sec3">Conclusions</a> for other > reference.</para> > </section> > <section id="sec2"> > <title>Results</title> > <para>Data here. See <a link="sec1">Methods</a> for other > reference.</para> > </section> > <section id="sec3"> > <title>Conclusions</title> > <para>Data here. See <a link="sec2">Results</a> for other > comment.</para> > </section> > </sections> > </root> > > thanks and regards. > aaron
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xml to csv, Geert Josten | Thread | [xsl] Windows file path to uri (iri, andrew welch |
[xsl] xml to csv, Serena Phan | Date | Re: [xsl] XSLT 1.0, relative URIs, , Ragulf Pickaxe |
Month |