[thelist] Drawing XML Content into URLs in an XSL Doc

Ed Courtenay ed at edcourtenay.co.uk
Tue Nov 20 10:19:53 CST 2001


I don't know if this will help you or not, but I thought a working example
might help you on your way. This is the XML/XSL transformation I use for my
links list in the right hand sidebar on my site
(http://www.edcourtenay.co.uk):

links.xml
---------

<?xml version="1.0" encoding="utf-8"?>
<links>
	<link URI="http://www.issolutions.co.uk" name="IS Solutions Plc">
		The company I work for
	</link>
	<link URI="http://coveryourasp.com" name="Cover Your ASP">
		James Shaw's great ASP site
	</link>
	<link URI="http://www.gotdotnet.com" name="GotDotNet">
		An excellent resource fot all things .NET
	</link>
	<link URI="http://www.ideasincluded.co.uk" name="Ideas Included">
		Phil South's rather spanky site, full of 3D goodness!
	</link>
	<link URI="http://www.ebbatson.com" name="Pablo">
		_Pablo presents a web site? Cool!
	</link>
	<link URI="http://www.activeisp.com" name="Active ISP">
		Active ISP - my current ISP, quite good actually...
	</link>
	<link URI="http://www.evolt.org" name="Evolt">
		Workers of the Web, Evolt!
	</link>
	<link URI="http://www.redmeat.com/redmeat/current/index.html" name="Red
Meat">
		From the secret files of Max Cannon...
	</link>
	<link URI="http://www.userfriendly.org/static/" name="User Friendly">
		The daily comic strip for geeks. Cool!
	</link>
	<link URI="http://riddleme.com/html/cow.html" name="I'm A Cow">
		Bizarre. Hilarious. Definately for Adults only. A must see!
	</link>
</links>

links.xsl
---------

<?xml version="1.0"?>
<xsl:stylesheet xmlns="http://www.w3.org/XML/1998/namespace"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

	<xsl:strip-space elements="links link"/>

	<xsl:template match="links">
		<div id="links">
			<div class="line"></div>
			<div class="listheader">Links</div>
			<xsl:for-each select=".//link">
				<xsl:sort select="@name"/>
				<div class="listitem"><a><xsl:attribute name="href"><xsl:value-of
select="@URI"/></xsl:attribute><xsl:attribute name="title"><xsl:value-of
select="normalize-space(.)"/></xsl:attribute><xsl:value-of
select="@name"/></a></div>
			</xsl:for-each>
		</div>
	</xsl:template>
</xsl:stylesheet>


Hope that helps...


-----Original Message-----
From: thelist-admin at lists.evolt.org
[mailto:thelist-admin at lists.evolt.org]On Behalf Of Scott Adamson
Sent: 19 November 2001 08:08
To: thelist at lists.evolt.org
Subject: Re: [thelist] Drawing XML Content into URLs in an XSL Doc


if you are passing a parameter to the page i cant help you on that one, ive
never donw that before, i normally merge the xml/xsl on the server in asp
and add extra nodes for the passed parameters.

things to look out for are that your select is in the rigt place

as in
<xml>
  <item>
    <text>
      some text
    </text>
  </item>
</xsml>
<xml>
  <item>
    <text>
      some more text
    </text>
  </item>
</xml>
<root>

calling select="text" will get you nothing unless you are in a <xsl:for-each
select="*/xml"> </xsl:for-each> or a template match for */xml

you could use <xsl:value-of select="/root/xml/item/text"/> and that would
pull just the first item.

if i hear anything about passing params and using the value ill post it on.


----- Original Message -----
From: "Megan Holbrook" <meganwh at prodigy.net>
To: <thelist at lists.evolt.org>
Sent: Friday, November 16, 2001 9:33 PM
Subject: Re: [thelist] Drawing XML Content into URLs in an XSL Doc


> Thanks to both evolters who responded to my question with suggestions -
> unfortunately, now I seem to have a different problem. I tried both:
>
> <a><xsl:attribute name="href"><value-of
> select="url"/></xsl:attribute><xsl:value-of
> select="thetextofthelink"></xsl:value-of></a>
>
> and
>
>  <a href="{@alternateur}"><xsl:value-of
> select="thetextofthelink"></xsl:value-of></a>
>
> ...and both returned links that had empty hrefs...is there something
> else I need to be doing?
>
> Thanks so much for the help...
>
> :) M.
>
> Craig Saila wrote:
> >
> > Megan Holbrook wrote:
> >
> > > What's wrong with using:
> > > <a href="<xsl:value-of select="url"></xsl:value-of>"> ?
> >
> > You can also try:
> > <a href="{@url}">blah</a>
> >
> > --
> > Cheers,
> >
> > Craig Saila
> > ------------------------------------------
> > craig at saila.com  :  http://www.saila.com/
> > ------------------------------------------
> >
> > _________________________________________________________
> > Do You Yahoo!?
> > Get your free @yahoo.com address at http://mail.yahoo.com
> >
> > ---------------------------------------
> > For unsubscribe and other options, including
> > the Tip Harvester and archive of TheList go to:
> > http://lists.evolt.org Workers of the Web, evolt !
>
> --
> Megan Holbrook - megan at kapow.com
> Partner - Business Development
> kapow, inc. (www.kapow.com)
>
> kapow, inc. Milwaukee               kapow, inc. Los Angeles
> 2405 E. Wyoming Place               2130 Sawtelle Blvd, #302A
> Milwaukee, WI 53202                 Los Angeles, CA 90025
> T: 414-273-2446 * F: 419-793-6271   T: 310-479-2020 * F: 310-473-3711
>
> ---------------------------------------
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to:
> http://lists.evolt.org Workers of the Web, evolt !
>


---------------------------------------
For unsubscribe and other options, including
the Tip Harvester and archive of TheList go to:
http://lists.evolt.org Workers of the Web, evolt !





More information about the thelist mailing list