xsl-list
[Top] [All Lists]

Re: Basic question: placing a link element inside a text?

2002-12-30 04:29:33
On Monday 30 December 2002 11:42, "Hubert Holtz"  wrote:
I have a simple article with some parameters, and in this paramter I want
You probably mean "paragraphs" instead of "parameter".

to put some links, but the final html file puts the link under the text and
not at the position in the text.
The paragraph is text mixed with elements. You use pull style
processing (xsl:for-each). Push style processing is much better
suited for processing mixed content.
Declare templates for processing <para> and <ulink>
elements and use xsl:apply-templates to apply them:
<xsl:template match="sect1[(_at_)lang='ger']">
  <table ...
    <tr>
      <td>
        <xsl:apply-templates select="para"/>
      </td>
  ...
</xsl:template>
<xsl:template match="para">
  <xsl:apply-templates/>
  <br/><br/>
</xsl:template>
<xsl:template match="ulink">
  <a href="{(_at_)url}">
    <xsl:choose>
      <xsl:when test="count(child::node())=0">
        <xsl:value-of select="@url"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:apply-templates/>
      </xsl:otherwise>
    </xsl:choose>
  </a>
</xsl:template>

The default templates will take care of copying text through.

J.Pietschmann

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



<Prev in Thread] Current Thread [Next in Thread>