Thread View: comp.text.xml
2 messages
2 total messages
Started by Torsten Lund
Tue, 08 Aug 2000 00:00
Formatting xml attributes via stylesheets.
Author: Torsten Lund
Date: Tue, 08 Aug 2000 00:00
Date: Tue, 08 Aug 2000 00:00
37 lines
1733 bytes
1733 bytes
Hello. I have created a xml document. I have also created a xsl stylesheet to transform the data into a html presentation. However, i don't know how to process attributes in the style sheet. Maybe an example would clearify :o) The xml document <Unit id="0"> ... <errordescription>Code 564:</errordescription> ... </Unit> The xsl style sheet ... <body> <xsl:value-of select="Unit/errordescription"> </body> ... when viewing the xml document in IE, it writes "Code 564:" as it should, but how do I print out the value of "id" in the xml document?!? What is the xsl syntax to do this ?!? -- Med venlig hilsen / Best Regards: Torsten Lund Partner Electric E-mail: tel@pel.dk TLF: +45 73 20 00 00 Fax: +45 73 20 00 01 DDI Fax : +45 73 24 15 17 Website: http://www.pel.dk ------------------------------------------------------- Please remove *nospam* in order to reply
Re: Formatting xml attributes via stylesheets.
Author: Thierry Bezecourt
Date: Tue, 08 Aug 2000 00:00
Date: Tue, 08 Aug 2000 00:00
29 lines
1768 bytes
1768 bytes
In article <8moit0$fca$1@news1.tele.dk>,
"Torsten Lund" <tel*nospam*@pel.dk> wrote:
> <Unit id="0">
> ...
> <errordescription>Code 564:</errordescription>
> ...
> </Unit>
> when viewing the xml document in IE, it writes "Code 564:" as it
> should, but how do I print out the value of "id" in the xml
> document?!? What is the xsl syntax to do this ?!?
Upgrade to the latest MSXML version (if necessary), and try this:
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
version='1.0'>
<xsl:template match='unit'>
<body>
Unit <xsl:value-of select='@id' />.
</body>
</xsl:template>
</xsl:stylesheet>
--
Thierry B�zecourt
Sent via Deja.com http://www.deja.com/
Before you buy.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads