xsl-list
[Top] [All Lists]

Re: [xsl] [XSL] id() in Ancestor Nodes?

2007-10-03 22:22:14
At 2007-10-03 23:28 -0400, Alice Ju-Hsuan Wei wrote:
I am trying to use the id function in XSLT to extract the publication id information from the "attribute" and have the output display the name of the publisher itself as it is. The complete code is as follows:

XML:

<bookshelf>

I note there is no DTD declaration of the attribute that has the ID type ... therefore, if you are using XSLT 1.0 you will need:

<!DOCTYPE bookshelf
[
<!ATTLIST publication xml:id ID #IMPLIED>
]>
<bookshelf>

If you are using XSLT 2.0, it is up to your XSLT processor to choose to implicitly support xml:id (ref: 3.11 note), and if it does not, the above is required.

I tried using the id function:

<xsl:template name="bookpublisher">
       <xsl:variable name="name" select="id('@publish')"/>

If the processor is not instructed which attributes of which elements have attributes of type ID (the name is irrelevant; the type is given in a DTD declaration) for a given document, then the id() table is empty for the document.

I hope this helps.

. . . . . . . . . . . . . Ken


--
Upcoming public training: UBL and code lists Oct 1/5; Madrid Spain
World-wide corporate, govt. & user group XML, XSL and UBL training
RSS feeds:     publicly-available developer resources and training
G. Ken Holman                 mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Jul'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


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

<Prev in Thread] Current Thread [Next in Thread>