Subject: Testing/searching for several elements using xsl
From: Thomas Weholt <u970130@xxxxxxxxxxxxx>
Date: Wed, 14 Apr 1999 11:08:11
|
Hello,
Note! This mail is related to the "Searching huge xml-documents" question I
posted earlier, but it`s intereseting by itself too.
I want to locate several "entries"-elements in a xml-document using a
entry-elements "no"-attribute.
Sample xml-doc :
<cd_doc>
... info about the cd ...
<entries>
<entry no="1" path="/cdrom/stugg/long path/more
text/python_stuff.tar.gz" ... more info .../>
... lots of more entries
</entries>
</cd_doc>
I tried with a stylesheet like this :
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="cd_doc">
<HTML>
<BODY>
<h2>Result of search</h2>
<xsl:apply-templates select="entry"/>
</BODY>
</HTML>
</xsl:template>
<xsl:template match="entry">
<xsl:choose>
<xsl:when test='.[@no="1"|@no="21"|@no="1432"]'>
<xsl:apply-templates select=""/>
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
But it didn`t work. I want to process entries with attribute numbers equal
to 1, 21 and 1432. Used Xt to generate HTML with these documents.
----------------------------------------------
Thomas Weholt
eMail : weholt@xxxxxxxxxxxxxx
HTTP://www.linuxfreak.com/~weholt
Phone : +47 - 92 09 59 68
----------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|