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

Re: Attribute value

Expand Messages
  • Sev 'n' Janis
    Hi Susan, I m a long-time reader, first-time poster to this list, and I think I have a solution for you. In order to put the value of your equation into an
    Message 1 of 3 , Nov 7, 2001
      Hi Susan,

      I'm a long-time reader, first-time poster to this list, and I think I
      have a solution for you.

      In order to put the value of your equation into an attribute, you
      need to use xsl:element and xsl:attribute to create your element and
      attribute. The following code should work.

      <xsl:template name="createCdRegion">

      <xsl:variable name="offset" select="362"/>
      <xsl:variable name="increment" select="2"/>

      <xsl:element name="CdRegion">
      <xsl:attribute name="ServiceName">CD-REGION</xsl:attribute>
      <xsl:attribute name="ToOffset"><xsl:value-of select="position() *
      $increment + $offset"/></xsl:attribute>
      </xsl:element>

      </xsl:template>

      The output would look like this.
      <CdRegion ServiceName="CD-REGION" ToOffset="[your value here]"/>

      Good luck,
      Severin



      --- In XSL-FO@y..., badleedo@y... wrote:
      > Greeting...I'm hoping that you all can help me. I'm kind of new to
      > XSL. I'm trying to keep a "running total" and populate an
      attribute
      > with the running total. In the following code snippet,
      > this code: position() * $increment + $offset gives me the answer
      that
      > I want. Only problem is, I want to stick the result in the
      attribute
      > called "ToOffset". If I just put the formula in there, I get the
      > formula back, I want the *result* of the formula. Any ideas???
      >
      > Thanks much,
      > Susan Vodar
      >
      >
      > <xsl:template name="createCdRegion">
      >
      > <xsl:variable name="offset" select="362"/>
      > <xsl:variable name="increment" select="2"/>
      >
      > <CdRegion ServiceName="CD-REGION" ToOffset="">
      > <xsl:value-of select="position() * $increment + $offset"/>
      > </CdRegion>
      >
      > </xsl:template>
    • joshua.kuswadi@btfinancialgroup.com
      ... You can also try, instead of the code above: where the curly braces {}
      Message 2 of 3 , Nov 7, 2001
        Severin wrote:
        > <xsl:element name="CdRegion">
        > <xsl:attribute name="ServiceName">CD-REGION</xsl:attribute>
        > <xsl:attribute name="ToOffset"><xsl:value-of select="position() *
        > $increment + $offset"/></xsl:attribute>
        > </xsl:element>

        You can also try, instead of the code above:
        <CdRegion ServiceName="CD-REGION" ToOffset="{position() * $increment + $offset}" />

        where the curly braces {} will work as Attribute Value Templates (AVTs) and evaluate the XPath expression within them.

        Joshua

        ------------------------------------------------------------------------------
        This message and any attachment is confidential and may be privileged or otherwise protected from disclosure. If you have received it by mistake please let us know by reply and then delete it from your system; you should not copy the message or disclose its contents to anyone.
      Your message has been successfully submitted and would be delivered to recipients shortly.