🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text.xml
Article #55

Re: Formatting xml attributes via stylesheets.

#55
From: Andreas Popper
Date: Thu, 23 Nov 2000 06:51
90 lines
3198 bytes
Torsten Lund wrote:
> 
> 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


Hi!

There is a solution for linking. May be it helps.

-----------------xml--------------------------------

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet href="navigation.xsl" type="text/xsl"?>
<?cocoon-process type="xslt"?>

<page>
	<titel>xml2sql</titel>
	<url>
		<datei>
			<link xml:link="simple" href="titel.xml">
			Titelblatt
			</link>
		</datei>
	
		<datei>
			<link xml:link="simple" href="planung01.xml">
			Projektplanung
			</link>
		</datei>
	</url>	
</page>

-----------------------------------------------------

the url-part of correspondending .xsl-stylesheet:

----------------...xsl-------------------------------

<xsl:template match="url">
			
		<xsl:for-each select="datei">
		<p>
		<a target="rechts">
		<xsl:attribute name="HREF">
		<xsl:value-of select="link/@href"/>
		</xsl:attribute>
		<xsl:value-of select="link"/>
		</a>
		</p>
		</xsl:for-each>
</xsl:template>

I hope, this will be usefull.

geronimo
Technical Details
Message-ID: <3A1CBE86.74EA8E1E@gmx.de>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!isdnet!fu-berlin.de!uni-berlin.de!pc-198.moebius.keynet.DE!not-for-mail
References: <8moit0$fca$1@news1.tele.dk>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1047a4,3c3ba754dd86eb08
X-Google-Attributes: gid1047a4,public
X-Google-Thread: 10cf74,3c3ba754dd86eb08
X-Google-Attributes: gid10cf74,public
X-Google-Thread: 115169,3c3ba754dd86eb08
X-Google-Attributes: gid115169,public
X-Google-Thread: 10cf80,3c3ba754dd86eb08
X-Google-Attributes: gid10cf80,public
X-Google-ArrivalTime: 2000-11-22 23:26:14 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!isdnet!fu-berlin.de!uni-berlin.de!pc-198.moebius.keynet.DE!not-for-mail
From: Andreas Popper <Andreas.Popper@gmx.de>
Newsgroups: comp.text.xml,dk.edb.internet.webdesign,microsoft.public.xml,netscape.public.mozilla.layout.xslt
Subject: Re: Formatting xml attributes via stylesheets.
Date: Thu, 23 Nov 2000 07:51:50 +0100
Lines: 90
Message-ID: <3A1CBE86.74EA8E1E@gmx.de>
References: <8moit0$fca$1@news1.tele.dk>
NNTP-Posting-Host: pc-198.moebius.keynet.de (194.195.155.198)
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: fu-berlin.de 974964371 4948692 194.195.155.198 (16 [45574])
X-Mailer: Mozilla 4.72 [en] (X11; I; Linux 2.2.14 i686)
X-Accept-Language: de