|
|
IntroductionConcatenating documents is easy. Let's concatenate two account records. Here are the files for the example. To run this example, extract the files and execute "go". The resulting output is in the file result.xml. Here is the first record: < Account><Balance>500</Balance> </Account> The second account is embedded in the style sheet: <?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/XSL/Transform/1.0">
<xsl:output
method="xml"
indent="yes"/>
<!--source
of data--> <Account>
<Balance>1000</Balance>
</Account>
</xsl:variable> <!-- Merge two <Accounts> by appending each Account --> <xsl:template
match="/">
<Dashboard>
<xsl:copy-of
select="*"/>
<xsl:copy-of
select="$source"/>
</Dashboard>
</xsl:template>
</xsl:stylesheet>
Here is the resulting document: < Dashboard><Account> <Balance>500</Balance> </Account> <Account xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"> <Balance>1000</Balance> </Account> </Dashboard> |