|
Subject: [xsl] using key to merge data From: Terry Ofner <tofner@xxxxxxxxxxx> Date: Mon, 22 Oct 2007 15:51:37 -0400 |
<top> <question> <info> <topic>Vocabulary</topic> <keyword>Prefixes</keyword> <notes>G4U1S01></notes> <foo>blah blah</foo> </info> </question> </top>
<top> <standard> <g_code>G4U1S01</g_code> <state-obj state="AZ">blah blah blah</state-obj> <state-obj state="TX">blah blah blah</state-obj> . . . </standard> </top>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:import href="copy.xslt"/> <xsl:output method="xml"/>
<xsl:variable name="standardFile" select="document('standards.xml')"/>
<xsl:key name="standard_by_g_code" match="standard" use="g_code"/> <xsl:template match="/">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template> <xsl:template match="question/info">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:variable name="question_g_code" select="notes"/>
<xsl:for-each select="$standardFile">
<xsl:copy-of select="key('standard_by_g_code', $question_g_code)"/>
</xsl:for-each>
</xsl:copy>
</xsl:template>
</xsl:stylesheet><top> <question> <info> <standard> <g_code>G4U1S01</g_code> <state-obj state="AZ">blah blah blah</state-obj> <state-obj state="TX">blah blah blah</state-obj> . . . </standard> </info> </question> </top>
<top> <question> <info> <topic>Vocabulary</topic> <keyword>Prefixes</keyword> <notes>G4U1S01></notes> <foo>blah blah</foo> <state-obj state="AZ">blah blah blah</state-obj> <state-obj state="TX">blah blah blah</state-obj> . . . </info> </question> </top>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="node( ) | @*"> <xsl:copy> <xsl:apply-templates select="@* | node( )"/> </xsl:copy> </xsl:template> </xsl:stylesheet>
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Date, Number Format, Waqar Ali | Thread | RE: [xsl] using key to merge data, Michael Kay |
| Re: [xsl] Date, Number Format, cknell | Date | RE: [xsl] using key to merge data, Michael Kay |
| Month |