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

Re: XSL/XML External Link

Subject: Re: XSL/XML External Link
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 06 Jun 2001 17:58:17 +0100
xsl external link
Morais,

Your problem isn't the link. It's the whole approach to processing you are using.

The offending code is the bit here:
At 09:14 PM 6/6/01, you wrote:
>                               <xsl:for-each select="paratext">
>                               <xsl:value-of select="text()"/>
>                               <xsl:for-each select="extlink"><A
> target="newwindow">
>                               <xsl:attribute name="href">
>                               <xsl:value-of
> select="@fileref"/></xsl:attribute>
>                               <xsl:value-of
> select="text()"/></A></xsl:for-each>
>                               </xsl:for-each>

What this is saying is (translated into something like English),


For each paratext, get me:
  The value of the set of text node children,
  Then, for each extlink child,
    An <A target="newwindow"> element,
    with an href attribute,
      whose value is the fileref attribute,
    then the value of the set of text node children....

But according to XSLT, the value of a set of nodes is the value of the first node in the set. So when you say <xsl:value-of select="text()"/>, you are only getting *one* text node (the first) from the set, and the rest are being thrown away.

This is why you are only getting the text up to the link (because that's the snippet in the first text node). Even if you did get the others, they'd be in the wrong place in your output.

You'd be better off with a standard, XSLT-ish template-based solution. You could simply say

<xsl:template match="paratext">
  <p>
    <xsl:apply-templates/>
  </p>
</xsl:template>

<xsl:template match="extref">
  <a target="newwindow" href="{@fileref}">
    <xsl:apply-templates/>
  </a>
</xsl:template>

It would get you the output you want, and it would be way, way easier to code and maintain.

If this is mysterious to you, a little research on the XSLT processing model might be in order. It's been explained on this list many, many times, so check the archive if your other sources are no help.

Good luck,
Wendell



======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


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.