xsl-list
[Top] [All Lists]

Re: [xsl] Retrieving top-level attribute value in XSLT 2.0

2006-08-31 14:09:13
Okay, I've now tried that. There is no change: the date is not sent
into my output document.

On 8/31/06, Joe Fawcett <joefawcett(_at_)hotmail(_dot_)com> wrote:
The document node has a namespace, either add the namespace declaration to
the stylesheet with a prefix and use that or for simplicity use:
<xsl:value-of select="*/@from" />

Joe

----- Original Message -----
From: "Mukul Gandhi" <gandhi(_dot_)mukul(_at_)gmail(_dot_)com>
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Sent: Thursday, August 31, 2006 7:33 PM
Subject: Re: [xsl] Retrieving top-level attribute value in XSLT 2.0


> You must do:
>
> <xsl:value-of select="xtvd/@from" />
>
> On 8/31/06, Bob Portnell <simply(_dot_)bobp(_at_)gmail(_dot_)com> wrote:
>> Hi, kids. This is darn embarassing, but I've tried everything I know
>> and several things I don't and gotten nowhere. The problem is
>> ludicrously simple. Given this input XML (this is the root element of
>> the file...):
>>
>> <xtvd from='2006-08-31T15:44:36Z' to='2006-09-06T15:44:36Z'
>> schemaVersion='1.3' xmlns='urn:TMSWebServices'
>> xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
>> xsi:schemaLocation='urn:TMSWebServices
>> http://docs.tms.tribune.com/tech/xml/schemas/tmsxtvd.xsd'>
>>
>> I'm trying to grab the dateTime in the from attribute and park it in
>> my result HTML:
>>
>> <xsl:template match="/">
>>        <html>
>>                <head> (Omitted; it works) </head>
>>                <body>
>>                        <h1>
>>                                (other omitted but working code)
>>                                <xsl:value-of select="@from" />
>>                        </h1>
>>                </body>
>>        </html>
>> </xsl:template>
>>
>>
>> When I run this through Saxon, it kindly informs me:
>>
>> Warning: on (that line where you've got @from):
>>  The attribute axis starting at a document-node() node will never
>> select anything
>>
>> Which leads me to believe that somehow I'm not actually addressing the
>> <xtvd> element. But I've tried every combination of symbols I can
>> imagine to get down from document-node() to its child <xtvd> and
>> almost nothing works. The closest I get is "//@from", which gets me
>> that dateTime and a bunch of other dates further down the document. If
>> I could figure out a sensible predicate for "//@from" to single out
>> the one in <xtvd>, that'd work too.
>>
>> (And my copy of XSLT COOKBOOK is en route, so I shan't bother the list
>> with baby questions too much longer.)
>>
>> Thanks,
>> Bob P
>> simply(_dot_)bobp(_at_)gmail(_dot_)com
>
>
> --
> Regards,
> Mukul Gandhi
>
> http://gandhimukul.tripod.com
>
> --~------------------------------------------------------------------
> 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>
> --~--
>
>


--~------------------------------------------------------------------
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>
--~--



--~------------------------------------------------------------------
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>
--~--