[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Selecting the value from diff i/p XML
I'm not 100% sure I understand what OP wants, but the following XSLT 1.0 program generates what I think is the desired output, albeit probably a lot less efficiently than could be done with clever keys. Note that I couldn't bring myself to have attributes named id= that are not xsd:ID, so I renamed it to record=. <?xml version="1.0" encoding="UTF-8"?> <!-- read in Root2 as input, and correlate the record= --> <!-- of each <data> with the corresponding record= of --> <!-- an <item> in Root1, and spit out the value= of --> <!-- the first match --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <wrapper> <xsl:apply-templates select="root2/data"/> </wrapper> </xsl:template> <xsl:template match="data"> <out> <xsl:value-of select="@record"/> <xsl:text>=</xsl:text> <xsl:value-of select="document('./Root1.xml')/root1/item[@record=current()/@record]/@value"/> </out> </xsl:template> </xsl:stylesheet>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|