xsl-list
[Top] [All Lists]

[xsl] xsl variable/param question

2010-05-25 09:26:21
So i have an xml file exported from Excel with this structure:
<Row>
  <Cell><Data>John Doe Elementary School</Data></Cell>
  <Cell><Data>321-123-1234</Data></Cell>
  <Cell><Data>123 Cool Rd.</Data></Cell>
  <Cell><Data>Suite 101</Data></Cell>
  <Cell><Data>Mesa</Data></Cell>
  <Cell><Data>AZ</Data></Cell>
  <Cell><Data>85203</Data></Cell>
</Row>

and when I loop each Row... I'd like to output via xsl:message the
state IF its different than the previous one... I was going to use
this output to make sure my html drop down I was creating to unhide
and show the location divs I'm creating for each Row was updated, but
create the drop down manually now since Im not sure how to save and
compare the state value for each loop.

My basic xsl looks like following

  <xsl:template match="/">
    <html><body>
      <xsl:apply-templates select="//Row"/>
    </body></html>
  </xsl:template>

  <xsl:template match="Row">

    <xsl:message><xsl:value-of select="Cell[6]/Data"/></xsl:message>
    <div>
      <xsl:attribute name="class">location <xsl:value-of
select="Cell[6]/Data"/></xsl:attribute>
      <b><xsl:value-of select="Cell[1]/Data"/></b><br/>
      <xsl:value-of select="Cell[2]/Data"/><br/>
      <xsl:value-of select="Cell[3]/Data"/><xsl:if
test="normalize-space(Cell[4]/Data) != ''">, <xsl:value-of
select="Cell[4]/Data"/></xsl:if><br/>
      <xsl:value-of select="Cell[5]/Data"/>, <xsl:value-of
select="Cell[6]/Data"/>, <xsl:value-of select="Cell[7]/Data"/><br/>
    </div>
  </xsl:template>

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>