Subject: RE: [xsl] More newbie questions From: mylistaddress@xxxxxxxxxx Date: Wed, 23 Mar 2005 03:04:03 -0800 (PST) |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] More newbie questions, Michael Kay | Thread | Re: [xsl] More newbie questions, David Carlisle |
Re: [xsl] Re: Convert a XML string , António Mota | Date | RE: [xsl] how to do i18n with param, George James |
Month |