[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: without a loop file get the element list

Subject: Re: without a loop file get the element list
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Wed, 13 Aug 2008 11:16:19 +0100
Re:  without a loop file get the element list
>  I have following xml and XSL file as bellow.
>  An application calls the XSL file and disply the
>  nodes
>  contents in a windows as a html.
>  With a for-each loop i get each node content
>  (element)
>  more times. For example in this sample xml file each
>  element is displayed three times because there are 3
>  elements in the xml file and so on.
>  I t seems that each time ""for each" elment in the
>  for-each loop, the whole elements are displayed!
>  Calling the xml file from web browser the XSL
>  Stylesheet works fine and the elemnts are
>  displayed only one time as expected.
>  I thought to walk throw the 'elements list' without
>  the for-each loop and display the elements but I
>  don't know how to do it!!??
>  Thank you for your help
>  *******************************
> <?xml version="1.0" encoding="iso-8859-1"?>
> <?xml-stylesheet type="text/xsl" href="text-1.xsl" ?>
> <document>
>   <elements>
>     <element type="author">Author-Element</element>
>      <element
> type="paragraph">Paragraph-Element</element>
>    <element type="title">Title-Element</element>
>  </elements>
> </document>
> *****************************************************************
> <?xml version="1.0" encoding="iso-8859-1"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>  <xsl:template match="/">
>    <html>
>      <body>
>     <table >
>        <xsl:for-each select="document/elements/element">
>        <tr><td>
>        <!--  <xsl:value-of disable-output-escaping="yes"
> select="current()"/>  -->
>           <xsl:value-of select="."/>
>                </td></tr>
>   </xsl:for-each>
> </table>
>      </body>
>    </html>
>  </xsl:template>
> </xsl:stylesheet>

It's hard to tell what you're after, but it looks like you're trying
to output a table based on that input where <elements> is a row and
<element> is a cell, so you just want:

	<xsl:template match="/">

	<xsl:template match="elements">

	<xsl:template match="element">
			<xsl:value-of select="."/>

Andrew Welch
Kernow: http://kernowforsaxon.sf.net/

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.