Loading ...
Sorry, an error occurred while loading the content.

Re: Getting a value depending on the value of another element

Expand Messages
  • David Christiansen
    Never mind. I am using the second method now, and it s problem was how I did the not equals. I have most frequetly used a language that used , so I tried
    Message 1 of 2 , Apr 28, 2003
    • 0 Attachment
      Never mind. I am using the second method now, and it's problem was how
      I did the not equals. I have most frequetly used a language that used
      <>, so I tried that. I am now doing
      not(normalize-space($attribute.name)=normalize-space(AttributeName))

      I would like to figure out why my first approach did not work, but I
      am not going to loose any sleep over this.

      David.

      --- In XSL-FO@yahoogroups.com, "David Christiansen" <DavidCh@S...> wrote:
      > Fellow Programmers,
      >
      > I am trying to create a report where I get a collumn value from an
      > element that dependens on a value of one of the other elements in the
      > group.
      >
      > I have an xml document (fragment listed below), and I am trying to get
      > the following out of it:
      >
      > Railcar
      > -------
      > 350899
      >
      >
      > In my first attempt (listed first), the result was something like this:
      > Railcar
      > -------
      > 350899 Unload Dirt
      >
      > I then tried a completly different approach, in which I tried to use
      > the Invoices/Invoice/Activity/Attributes/Attribute template more as a
      > user-defined method. I added this template, and the modifications as
      > shown on the second xsl document. At this time, I got an error
      > "Programmer's assertion in getNextStepPos: unknown stepType: -1"
      >
      > If anyone has an idea that may help, I would appreciate any suggestion.
      >
      > David.
      >
      >
      > XML:
      > <Invoices>
      > <Invoice>
      > <Activity>
      > <Revenue>
      > </Revenue>
      > <Attributes>
      > <Attribute>
      > <AttributeName>
      > Comments
      > </AttributeName>
      > <Value>
      > Unload Dirt
      > </Value>
      > </Attribute>
      > <Attribute>
      > <AttributeName>
      > Railcar Number
      > </AttributeName>
      > <Value>
      > 350899
      > </Value>
      > </Attribute>
      > </Attributes>
      > </Activity>
      > </Invoice>
      > </Invoices>
      >
      >
      >
      > XSL - attempt 1:
      > <xsl:template match="Invoices/Invoice/Activity/Revenue">
      > <fo:table-cell column-number="3">
      > <fo:block font-size="10.0pt" font-family="serif"
      > text-align="start">
      > <xsl:apply-templates
      > select="../Attributes/Attribute[AttributeName='Railcar Number']/Value"/>
      > </fo:block>
      > </fo:table-cell>
      > </xsl:template>
      >
      > <xsl:template match="Invoices/Invoice/Activity/Attributes/Attribute">
      > </xsl:template>
      >
      > <xsl:template
      > match="Invoices/Invoice/Activity/Attributes/Attribute/Value">
      > <xsl:value-of select="."/>
      > </xsl:template>
      >
      >
      >
      > XSL - attempt 2:
      > <xsl:template match="Invoices/Invoice/Activity/Revenue">
      > <fo:table-cell column-number="3">
      > <fo:block font-size="10.0pt" font-family="serif"
      > text-align="start">
      > <xsl:apply-templates select="../Attributes/Attribute">
      > <xsl:with-param name="attribute.name">
      > Railcar Number
      > </xsl:with-param>
      > </xsl:apply-templates>
      > </fo:block>
      > </fo:table-cell>
      > </xsl:template>
      >
      >
      > <xsl:template match="Invoices/Invoice/Activity/Attributes/Attribute">
      > <xsl:param name="attribute.name">
      >
      > </xsl:param>
      > <xsl:choose>
      > <xsl:when
      >
      test="normalize-space($attribute.name)<>normalize-space(AttributeName)">
      > <xsl:text></xsl:text>
      > </xsl:when>
      > <xsl:otherwise>
      > <xsl:value-of select="Value"/>
      > </xsl:otherwise>
      > </xsl:choose>
      > </xsl:template>
      >
      > <xsl:template
      > match="Invoices/Invoice/Activity/Attributes/Attribute/Value">
      > <xsl:value-of select="."/>
      > </xsl:template>
    Your message has been successfully submitted and would be delivered to recipients shortly.