[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Testing/searching for several elements using xsl
Thomas, You are trying to select "entry" as if it was a child of "cd_doc", you will need to change you select expression to "entries/entry". --Keith Thomas Weholt wrote: > > 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 XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|