This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Problems generating a link in HTML output


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]