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

Re: [Fwd: Placing ID's when cited]

Subject: Re: [Fwd: Placing ID's when cited]
From: Ragulf Pickaxe <ragulf.pickaxe@xxxxxxxxx>
Date: Mon, 21 Nov 2005 09:24:59 +0100
 Re: [Fwd: Placing ID's when cited]
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

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.