Re: several questions on XML to HTML processing with XSL

Subject: Re: several questions on XML to HTML processing with XSL
From: Warren Hedley <w.hedley@xxxxxxxxxxxxxx>
Date: Fri, 09 Jun 2000 11:26:50 -0400
H.vanderLinden@xxxxxxxxxxxxx wrote:
> This is similar to what I have except for the <xsl:apply-templates /> part.
> This is more detailed with <xsl:call-template...> statements.
> I want to get rid of this structure since it involves copying the actual
> content of the DIV/LAYER part and
> modifications to that part should be carried out twice.

Michael Kay's answer was actually much better than mine.
Use <xsl:element name="{$PageSection}"> ...

> > turns <img src="img.jpg" /> into <img src="img.jpg">
> > and <br /> into <br>.
> Ah well, I didn't know about that (thanks for the info) but at the moment
> it's not relevant to my problem.

Actually - it's completely relevant.

> <maintext>
> <table cellspacing='0' border='0'>
> <tr><td><img src='myimage.jpg'></td><td>some text</td></tr>
> </table>
> <!-- some more HTML formatted text -->
> </maintext>

You should combine <xsl:copy-of /> with the HTML output method.

<xsl:template match="maintext">
  <xsl:copy-of select="child::node()" />

Use well-formed XML, and it will magically be transformed to
abbreviated HTML - ie. you should use <img /> in your XML.

> 4. How do I declare a variable parametername?
> I'd like to do the following, but Saxon returns an errormessage on the
> <xsl:with-param> line (invalid $ character).
> <xsl:variable name="ParamName">someXMLtag/@someAttribute</xsl:variable>
> <xsl:call-template name="SomeTemplateName">
>    <xsl:with-param name="$ParamName">whateverValue</xsl:with-param>
> </xsl:call-template>

I don't quite understand what you're trying to do - do you mean to
say that you don't know the name of a parameter in a named template?

The name attribute on <xsl:with-param> must be a QName, so you
can't set this dynamically in any case.

Warren Hedley

 XSL-List info and archive:

Current Thread