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

Re: [XSL-FO] RE: Multiple XML Files as Input

Expand Messages
  • Sangeetha Goli
    Thanks! that s exactly what i needed. SG ... select= document( b.xml )//LONGSTATE[preceding-sibling::SHORTSTATE=$STATE] / ...
    Message 1 of 3 , May 17 5:47 AM
    • 0 Attachment
      Thanks! that's exactly what i needed.


      SG
      --- ronald heller <ronald@...> wrote:
      > Your question is a XSLT one, not FO, but I gave it a
      > go anyway.
      > I think I have solved your problem try the example
      > below.
      > Use the stylesheet on a.xml and it'll work like a
      > charm.
      > Maybe it's not as good and clean as it should be,
      > but I'm not stopping you
      > for cleaning up the code. :-)
      >
      > Ronald Heller
      >
      > I used the following sources:
      >
      > a.xml
      > <?xml version="1.0"?>
      > <ROOT>
      >
      > <CITY>Highland Park</CITY>
      > <STATE>NJ</STATE>
      >
      > <CITY>Elmhurst</CITY>
      > <STATE>NY</STATE>
      >
      > </ROOT>
      >
      > b.xml
      > <?xml version="1.0"?>
      > <ROOT>
      > <SHORTSTATE>NJ</SHORTSTATE>
      >
      > <LONGSTATE>New Jersey</LONGSTATE>
      >
      > <SHORTSTATE>NY</SHORTSTATE>
      >
      > <LONGSTATE>New York</LONGSTATE>
      > </ROOT>
      >
      > xsl:
      > <?xml version="1.0"?>
      > <xsl:stylesheet version="1.0"
      > xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      > <xsl:template match="/">
      > <xsl:apply-templates select="ROOT"/>
      > </xsl:template>
      >
      > <xsl:template match="ROOT">
      > <xsl:for-each select="//STATE">
      > <xsl:variable name="STATE"><xsl:value-of
      > select="."/></xsl:variable>
      > <xsl:text>
      > - </xsl:text>
      > <xsl:value-of select="$STATE"/>
      > <xsl:text> Long name:</xsl:text>
      > <xsl:value-of
      >
      select="document('b.xml')//LONGSTATE[preceding-sibling::SHORTSTATE=$STATE]"/>
      >
      > </xsl:for-each>
      > </xsl:template>
      >
      > </xsl:stylesheet>
      >
      > my result:
      > - NJ Long name:New Jersey
      >
      > - NY Long name:New York
      >
      > This should help I think.
      >
      >


      __________________________________________________
      Do You Yahoo!?
      Yahoo! Auctions - buy the things you want at great prices
      http://auctions.yahoo.com/
    Your message has been successfully submitted and would be delivered to recipients shortly.