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

Re: Need some help on XPath in the XSL

Expand Messages
  • Vitaliy
    Try to do something like this: ... Building: Invoice:
    Message 1 of 3 , Nov 12, 2004
      Try to do something like this:

      <xsl:template match="building">
      Building: <xsl:value-of select="@name"/>
      Invoice: <xsl:value-of select="parent::core/@invoiceNum"/>
      Previous invoices: <xsl:variable name="bldgName"><xsl:value-of
      <xsl:for-each select="preceding::building[@name=$bldgName]">
      <xsl:value-of select="parent::core/@invoiceNum"/>
      <xsl:text> </xsl:text>

      --- In XSL-FO@yahoogroups.com, "Prashant Gupta" <pkumar@n...> wrote:
      > Hi All,
      > I have a problem writing the Xpath for the following scenario.
      The XML
      > (data) is like this:
      > <invoice>
      > <core invoiceNum="inv1">
      > <building name="BldgA"></building>
      > <vendor name="VenA"></vendor>
      > </core>
      > </invoice>
      > Similarly I have another node which is like this:
      > <invoice>
      > <core invoiceNum="inv2">
      > <building name="BldgA"></building>
      > <vendor name="VenB"></vendor>
      > </core>
      > </invoice>
      > And like wise I have many nodes with the similar kind of data.
      > Now I need to find out while processing the <building > of any node
      that if
      > there is already
      > a node (before in the processed node tree) with the same building name.
      > For example, while I am processing the building of the second invoice
      > node("inv2"), I need to know if there is any invoice
      > node with the same building name.
      > Can any please help me? I hope (though I am not sure) that I have
      > myself clearly. Please do write if you
      > need more explanation/clarification.
      > Thanks in advance,
      > Prashant
    Your message has been successfully submitted and would be delivered to recipients shortly.