[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: ?Formating Issue?

Subject: RE: ?Formating Issue?
From: "Passin, Tom" <tpassin@xxxxxxxxxxxx>
Date: Tue, 4 Nov 2003 11:26:44 -0500
xsl and livelink help
[SHEIKH Sajjad]Hi
> 
> Following is my xml.  I am looking for the output as [	
> You are here:
> Sajjad >>> Learning Material ] 
> 
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <?xml-stylesheet type="text/xsl" href="4.xsl"?>
> <livelink>
> <location path='..\'>sajjad</location>  
> <location last='true' path=''>Learning Material</location>
> </livelink>  
> 
> I don't know where am I making mistake in the following stylesheet.
> Since I get Sajjad Learning Material in one line but I can 
> not add ">>>"
> sign to it.
> 

It looks like you want to build up the path display using the "location"
elements, although your template seems to be trying to build them from
"livelink" elements instead.  Is this correct, that you want to use
:location" elements?  If not, I cannot understand what you are trying to
do, although a larger sample of the xml source might help.

Here is a basic way to to it -

<xsl:template match='livelink'>
   <xsl:apply-templates select='location'/>
</xsl:template>

<xsl:template match='location'>
   <xsl:value-of select='.'/> >>>
</xsl:template>

Now this is a bit too simple to use as is.   First of all, you do not
want the ">>>" separator appear after the last step of the path.  So you
have to use a test to prevent it.  You could use

<xsl:template match='location'>
   <xsl:value-of select='.'/> <xsl:if test='position() != last()'> >>>
</xsl:if>
</xsl:template>

Next, you would add the href elements, and it should be pretty obvious
how to add them.  BTW, you probably want to use a forward slash in the
paths, even if you are on Windows.

Finally, you can add any formatting you want, such as wrapping the steps
in their own "td" elements (although this probably will not be that
useful and could be omitted).

Notice that there is no need to use for-each, just select the nodes that
you want and apply the corresponding template.  Of course, you could
succeed with for-each as well, but it is a bit cleaner and simpler to
just use a template instead.

Cheers,

Tom P

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.