xsl-list
[Top] [All Lists]

RE: newbie question

2004-07-30 02:47:10
In XSLT 2.0:

<a href="{(link[matches(.,'^http://')],
link[matches(.,'^ftp://')])[1]}">title</a>

In 1.0:

<a>
 <xsl:attribute name="href">
  <xsl:choose>
   <xsl:when test="link(starts-with(., 'http://'))">
    <xsl:value-of select="link(starts-with(., 'http://'))"/>
   </xsl:when>
   <xsl:otherwise>
     <xsl:value-of select="link(starts-with(., 'ftp://'))"/>
   </xsl:otherwise>
  </xsl:choose>
 </xsl:attribute>
 title
</a>

-----Original Message-----
From: Dionylon Briones [mailto:lon(_at_)designbytes(_dot_)com(_dot_)ph] 
Sent: 31 July 2004 00:51
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] newbie question

hello everyone,
i'm new to XSL and need help with this problem:

choose a link for the title, base on the following conditions:
  1. if the value of the link node has 'http://' string
  2. if there's no 'http://' string get the value of the link 
node that
contains 'ftp://' string

output should be: <a href="selected link">title</a>

thanks

<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<record>
 <data>
  <link>http://www.link1.com</link>
  <link>3csbv</link>
  <link>ftp://link2.com</link>
  <link>http://www.link3.com</link>
  <title>title</title>
 </data>
 <data>
  <link>45csgh</link>
  <link>invalid link</link>
  <link>ftp://link1.com</link>
  <title>title</title>
 </data>
</record>


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