[xsl] skipping over first item in a list

Subject: [xsl] skipping over first item in a list
From: Bryan Tarantina <bryantarantina@xxxxxxxxx>
Date: Mon, 25 Mar 2002 10:01:29 -0800 (PST)
Hello,

Here's the problem... I have an XML file with this
basic structure...

<A>
  <B></B>
  <C></C>
  ...
  <elementA>chair.jpg</elementA>
  <D>
    <E>chair.jpg></E>
    <E>stool.jpg</E>
    <E>couch.gif</E>
  </D>
</A>


now, elementA is not always filled in... I have the
logic in place (I believe) to successfully check the
elementA element and if it is non-empty, to grab the
first element in section D and place it higher on the
page (HTML)... Here's my XSL code... and my dilema...

<xsl:template match="/">
  <table>
  <tr><td>
	<p class="hyperlink" align="center">

	<xsl:for-each select="//A/D/E">
	<xsl:choose>
	<xsl:when test="//A[elementA =   D/E]">
		  
		match found... ending 


	</xsl:when>
	<xsl:otherwise>
	<xsl:if test="//A[elementA != D/E]">
		no match, displaying photo
      <!-- HTML code for displaying the pic -->
	</xsl:if>
	</xsl:if>
	</xsl:otherwise>
	</xsl:choose>
	</xsl:for-each>

	</p>
	</td>
	</tr>
</table>
 ...

</xsl:template>
</xsl:stylesheet>


ok.. so here's the problem... what the code is
supposed to do: if elementA is non-empty, to put it at
the top of the HTML page and put the rest of the pics
further down in the page. If elementA is empty,
display a default pic and put the photos at the bottom
of the page.

What the code is doing... it is an all or nothing
situation... if elementA is empty, the pictures are
displayed at the bottom of the page correctly.
However, if elementA is non-empty, it successfully
grabs the photo and displays it at the top of the
page, but will not display ANY of the other pictures.
And what I need is if elementA is non-empty, to put
the picture at the top and display the rest of the
pics at the bottom... now one thing I can guarantee is
that if elementA is filled in, the element I have to
grab is ALWAYS the first in the list... 

so how do I do this?

Thanks,

Bryan

__________________________________________________
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread