csteinhilber
Programmer
I have an XML file that describes data to present in HTML. But one of the possible elements is what we're calling a "super element"... it's basically an node that describes another XML file that would need to be included into the HTML presentation.
So, for example, the base XML file is:
The otherdata element is our "super element". Based on it's attributes, it determines another XML file to include into this base XML.
So the super element might define the inclusion of data2.xml, such that:
The actual inclusion of the additional XML file is pretty straight-forward:
The problem I'm having is... I then need to process the entire XML dataset with the stylesheet. In other words, if I have:
it needs to match both the datarow elements in the original XML and the datarow elements in the data2.xml nodes that just got included.
Anybody have any ideas? Run two XSLTs, maybe... but what would they look like?
Any help would be appreciated!
Thanks,
-Carl
So, for example, the base XML file is:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<datapacket>
[COLOR=#ff0000]<otherdata>
<dataset>full</dataset>
<headers>true</headers>
</otherdata>[/color]
<datarow>
<element1>1</element1>
<element2>2</element2>
<element3>3</element3>
</datarow>
<datarow>
<element1>4</element1>
<element2>5</element2>
<element3>6</element3>
</datarow>
</datapacket>
The otherdata element is our "super element". Based on it's attributes, it determines another XML file to include into this base XML.
So the super element might define the inclusion of data2.xml, such that:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<datapacket>
<datarow>
<element1>7</element1>
<element2>8</element2>
<element3>9</element3>
</datarow>
</datapacket>
The actual inclusion of the additional XML file is pretty straight-forward:
Code:
<xsl:template match="otherdata">
<!-- some if/when/test to determine the name of the additional xml file -->
<xsl:value-of select="document('data2.xml')" />
</xsl:template>
The problem I'm having is... I then need to process the entire XML dataset with the stylesheet. In other words, if I have:
Code:
<xsl:template match="datarow">
:
</xsl:template>
Anybody have any ideas? Run two XSLTs, maybe... but what would they look like?
Any help would be appreciated!
Thanks,
-Carl