XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 2nd, 2004, 04:05 AM
wendyschuppen wendyschuppen is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 2 wendyschuppen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Angry Getting specific nodes displayed in a table using xsl

hi,
i'm having a huge problem getting my xml in a table with xsl !


this is my xml,

<?xml version="1.0" encoding="ISO-8859-15"?>
<objects>
<object avenue="auctions" id="2809755">
<room id="1401"/>
<title>Kachel op aardgas Wellstraler 7,60 kW</title>
<language>nl</language>
<image id="1755466"/>
</object>
<object avenue="auctions" id="2913991">
<room id="1401"/>
<title>SPLINTERNIEUWE MAZOUTTANK</title>
<language>nl</language>
<image id="1820070"/>
</object>
<object avenue="auctions" id="3004679">
<room id="1401"/>
<title>magnifique feux au bois</title>
<language>fr</language>
<image id="1760827"/>
<image id="1760828"/>
</object>
<object avenue="auctions" id="3004679">
<room id="1401"/>
<title>magnifique feux au bois</title>
<language>fr</language>
<image id="1760827"/>
<image id="1760828"/>
</object>
<object avenue="auctions" id="2913991">
<room id="1401"/>
<title>SPLINTERNIEUWE MAZOUTTANK</title>
<language>nl</language>
<image id="1820070"/>
</object>
</objects>


Now I have to get only the images from the nodes with language=nl into a table with 3 cells / row.
Is there a way to count how many nodes i have with language=nl and then loop through them ? Or maybe another way to do this.

Every suggestion is welcome !

thanks,
wendy

Reply With Quote
  #2  
Old June 2nd, 2004, 06:20 AM
nihaarika2002 nihaarika2002 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 49 nihaarika2002 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
hope this helps u

<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="html" indent="no" encoding="utf-8"/>


<xsl:template match="/">


<xsl:variable name="start" expr="'<tr>'"/>
<xsl:variable name="end" expr="'</tr>'"/>

<table border="1" cellpadding="0" cellspacing="0" width="300">

<xsl:for-each select="//objects/object[language='nl']">


<xsl:if test="position() mod 3=1">
<xsl:value-of select="$start" disable-output-escaping="yes"/>
</xsl:if>


<td width="100"> <xsl:value-of select="image/@id"/></td>


<xsl:if test="position() mod 3=0">
<xsl:value-of select="$end" disable-output-escaping="yes"/>
</xsl:if>


</xsl:for-each>





</table>

</xsl:template>







</xsl:stylesheet>


====================
with regards
niha

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > Getting specific nodes displayed in a table using xsl


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT