xml - xslt transform with a count -


i'm trying perform xslt transform on xml data html. there 3 tasks transform needs , these are:

  • sort data date
  • output id
  • output 3 of items

so example snippet of data looks this:

<program id="brand_id_1">     <date>2011-10-25</date>     <some_info>this info</some_info> </program> <program id="brand_id_2">     <date>2011-10-22</date>     <some_info>this info</some_info> </program> <program id="brand_id_1">     <date>2011-10-27</date>     <some_info>this info</some_info> </program> 

i can order date, can make sure output ones id brand_id_1, how stop outputting once i've done 3 times?

any help, appreciated! helen

sort , check position instance in following sample:

<xsl:for-each select="//program[@id = 'brand_id_1']">   <xsl:sort select="date" data-type="text"/>   <xsl:if test="position() &lt; 4">     <xsl:copy-of select="."/>   </xsl:if> </xsl:for-each> 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -