Altova Mailing List Archives


[xsl] Problems generating a link in HTML output

From: "Doug Metcalfe-White" <doug_metcalfe-white@------------>
To:
Date: 6/11/2002 10:36:00 AM
Hi all,

I am attempting to generate HTML from an XML source. Needless to say,
links will be an important part of the output. While I can generate the
links, I am getting a strange formatting to the inline links. For
example, my desired output is:

<p>The first rule of flying is that your number of take-offs should
always equal your number of <a href="landing.html">landings</a>.</p>

What I am getting is:

<p>The first rule of flying is that your number of take-offs should
always equal your number of landings.<a
href="landing.html">landings</a></p>

The XML source is:

<concept>
<para>The first rule of flying is that your number of take-offs should
always equal your number of <link
href="landing.html">landings</link>.</para>
</concept>

The file validates, so I'm only including an example of the troublesome
bit.

The XSLT file looks like this:

      	<xsl:template match="concept">
	     <xsl:apply-templates select="concept_title"/>
		<xsl:for-each select="para">
			<p><xsl:value-of select="."/>
			<xsl:apply-templates select="link"/>
			</p>
		</xsl:for-each>
  		<xsl:apply-templates select="list"/>
		<xsl:apply-templates select="table"/>
       </xsl:template>

<!-- The following generates exactly what I want.-->

 	<xsl:template match="link">
 	    <a>
 	     <xsl:attribute name="href">
 	       <xsl:value-of select="@href"/>
 	     </xsl:attribute>
 	     <xsl:value-of select="."/>
 	    </a>
 	</xsl:template>

The problem seems to be with the lines transforming the <para> element.
I have tried a couple of different approaches and this one has gotten me
closest to my desired output. I can't figure out how to change them to
get what I want. I have only begun to scratch the surface of XSLT and
XPath so it won't surprise me it the answer is found in some function
I'm unfamiliar with. Your advice and ideas are greatly appreciated.

I am processing the files using Instant Saxon 6.4.4.

Thanks,

Doug Metcalfe-White

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

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.