Re: [xsl] Getting the data after and before the specified node]

Subject: Re: [xsl] Getting the data after and before the specified node]
From: "watchstone@xxxxxxxxxxx" <watchstone@xxxxxxxxxxx>
Date: Wed, 5 Oct 2005 16:37:54 GMT
The main problem is with the structure of your code. <c> are all siblings of each other and don't relate the way you want because of that.  If you have the option to revise the structure of your code, it would be much better if you did this:

<xml>
     <a>
     <b>aaron</b>
     <c>butter</c>
     <c>bread</c>
     <c>fly</c>
     <c>team</c>
     </a>

     <a>
     <b>JOSE</b>
     <c>jack</c>
     <c>mary</c>
     <c>seph</c>
     <c>try</c>
     </a>
     <a>
     <b>Andrew</b>
     <c>aaron</c>
     </a>
</xml>







-------- Original Message --------
Subject: [xsl] Getting the data after and before the specified node
Date: Wed, 5 Oct 2005 04:08:05 -0700 (PDT)
From: aaron apigo <aaronjose_apigo2001@xxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx

hi all,

    I have the problem getting the getting the data
after and before the specified node:

with this:

<xml>
     <a>
         <b>aaron</b>
     </a>
     <c>butter</c>
     <c>bread</c>
     <c>fly</c>
     <c>team</c>
     <a>
         <b>JOSE</b>
     </a>
     <c>jack</c>
     <c>mary</c>
     <c>seph</c>
     <c>try</c>
     <a>
         <b>Andrew</b>
     </a>
     <c>aaron</c>
</xml>

output should be:

<?xml version="1.0" encoding="utf-8"?>
<root>
<label>aaron</label>
     <para>butter</para>
     <para>bread</para>
     <para>fly</para>
     <para>team</para>
<label>JOSE</label>
     <para>jack</para>
     <para>mary</para>
     <para>seph</para>
     <para>try</para>
<label>Andrew</label>
     <para>aaron</para>
</root>

I have this XSL:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">

     <xsl:template match="/xml">
      <xsl:apply-templates select="a" mode="test"/>
     </xsl:template>

     <xsl:template match="a" mode="test">
         <label>
            <xsl:apply-templates select="b"/>
         </label>
         <para>
             <xsl:apply-templates
select="following::c[?????????]"/>
         </para>
     </xsl:template>

     <xsl:template match="b">
         <xsl:apply-templates/>
     </xsl:template>

</xsl:stylesheet>

with this XSL, all the <c> were captured, what i want
is only the <c> that comes after <a> but before the
next <a>?
any idea on this.

thanks in advance.

regards.
aaron





		
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com

Current Thread