|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: More newbie questions
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="{@OutputFieldName}">
<xsl:apply-templates />
</xsl:element>
</xsl:template>
</xsl:stylesheet>
-------------
Any help greatly appreciated!
JW
|
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
|

Cart








