Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Gentoo.org index.xml - How's it done?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
wyvern
Tux's lil' helper
Tux's lil' helper


Joined: 04 Apr 2003
Posts: 99
Location: Victoria, B.C.

PostPosted: Mon May 12, 2003 5:47 pm    Post subject: Gentoo.org index.xml - How's it done? Reply with quote

After reading Daniel Robbin's experiences in setting up gentoo.org to use XML/XSL I was inspired to learn it and find out how to use it in my own web projects. It's been rewarding, but one thing is driving me nuts 8O

How does the gentoo.org index.xml 'import' the news 'nuggets'? The news items are stored in separate .xml files, and the index.xml (which is amazingly short) looks like this:

Code:
<?xml version='1.0'?>
<?xml-stylesheet href="/xsl/guide.xsl" type="text/xsl"?>
<mainpage id="news">
        <title>Gentoo Linux News</title>
        <version>Current</version>
        <newsitems/>
</mainpage>


So somehow the tag <newsitems/> causes guide.xsl (the style doc) to 'import' the news items and format them properly. Problem is, I've looked through the guide.xsl and I'm no closer to figuring out the mechanism by which it does this. Is it done on the fly by the web server?

Please tell me (or give me a hint), I'm dying to know! 8O I would love to be able to split my web pages into discrete XML files (would make updating things like nav bars and news sooooo easy). :)

Wyvern

---
Jan "Wyvern" Van Uytven
Sysadmin, UVic TRIUMF
wyvern@uvic.ca
Back to top
View user's profile Send private message
SuperTomate
Guru
Guru


Joined: 02 Jun 2002
Posts: 392
Location: France

PostPosted: Mon May 12, 2003 6:03 pm    Post subject: Reply with quote

This doc can help you : http://www.gentoo.org/proj/en/site.xml
Back to top
View user's profile Send private message
wyvern
Tux's lil' helper
Tux's lil' helper


Joined: 04 Apr 2003
Posts: 99
Location: Victoria, B.C.

PostPosted: Mon May 12, 2003 6:57 pm    Post subject: Reply with quote

I've already read all of those docs (and actually linked to one in my first post). None of them mention this topic. :(

Wyvern
_________________
---
ex nihilo nihil fit
Back to top
View user's profile Send private message
SPo0n
Tux's lil' helper
Tux's lil' helper


Joined: 03 May 2003
Posts: 85
Location: England

PostPosted: Mon May 12, 2003 7:25 pm    Post subject: Reply with quote

you could use php and the include function (www.php.net/include)
Back to top
View user's profile Send private message
wyvern
Tux's lil' helper
Tux's lil' helper


Joined: 04 Apr 2003
Posts: 99
Location: Victoria, B.C.

PostPosted: Mon May 12, 2003 7:43 pm    Post subject: Reply with quote

I know I could use PHP. There are any number of solutions to this, including using Daniel's useful pytext script. I know there are other ways, but I'm curious as to whether XSLT can do it, and if not, how is gentoo.org doing it?

Call it academic interest if you like :twisted:
_________________
---
ex nihilo nihil fit
Back to top
View user's profile Send private message
zhenlin
Veteran
Veteran


Joined: 09 Nov 2002
Posts: 1361

PostPosted: Tue May 13, 2003 11:03 am    Post subject: Reply with quote

XSLT, plus a few scripts.

<xsl:if test="/mainpage/@id='news'">
<br/><br/>
Older News:<br/>
<xsl:for-each select="document('/dyn/news-index.xml')/uris/uri[position()&=7][position()&20]/text()">
<xsl:variable name="newsuri" select="."/>
<a class="altlink" href="{$newsuri}"><xsl:value-of select="document(.)/news/title"/></a><br/>
</xsl:for-each>
</xsl:if>
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum