Hi,
OK, I have been kicking this around a little. In
regards to Michael Kay's note:
"> Depending where you are when you start, an
expression like
ancestor::Response/preceding-sibling::Database/@DatabaseName should do the
trick."
Again, I am trying to make the value of
Database/@DatabaseName appear in each instance of the
DATA tag. This ancestor and sibling stuff has me in a
knot...
Here is the XML:
<Root>
<Database DatabaseName="ABC123" />
<Report DatabaseId="1">
<SearchStatement>Canada</SearchStatement>
</Report>
<GetRecords>
<Response>
<Record>
<Field OutputFieldName="DOCI">EUP2050101000035</Field>
<Field OutputFieldName="TOPIC">INTERNATIONAL
POLITICAL</Field>
<Field OutputFieldName="DATE">2005 01 01</Field>
<Field OutputFieldName="FDATE">2005 01 01</Field>
<Field OutputFieldName="SS">THIS SHOULD NOT
APPEAR!</Field>
<Field OutputFieldName="CNTRY">Denmark</Field>
<Field OutputFieldName="CNTRY">Canada</Field>
<Field OutputFieldName="DIVI">Europe</Field>
<Field OutputFieldName="HEAD">Danish Daily Warns Not
to Expect Snow...!</Field>
<Field OutputFieldName="TEXT">CALGARY (CP) - Deputy
P...</Field>
</Field>
</Record>
</Response>
</GetRecords>
</Root>
Here is the XSL:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="Record">
<xsl:element name="DATA">
<xsl:element name="COLLECNAME">
<xsl:value-of select="??????/Database/@DatabaseName"
/>
</xsl:element>
<xsl:apply-templates select="Field" />
</xsl:element>
</xsl:template>
<xsl:template match="Field">
<xsl:element name="{(_at_)OutputFieldName}">
<xsl:apply-templates />
</xsl:element>
</xsl:template>
</xsl:stylesheet>
-------------
Any help greatly appreciated!
JW
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--