Hello

As I am writing XSLT documents, i was in a some case in this situation :

In one case, i want to surround an element with another one, in another case i don't

example :

if (@LINKED=='true') {
        <a href="....">
                content
        </a>
} else {
        content
}

I name this case "conditional surrounding"

where content is a multiline stuff

of course i see some of those saying i just have to call a template, but the content stuff use a lot of parameters so it is the same to copy/paste than to make a call.

So my questions are those

1) Can be handled simply in strict XSLT 1.0 ?
2) Can be handled simply with some extension of XSLT 1.0 ?
3) Can it be handled simply with last XSLT 2.0 WD ?
4) with XQuery ?
5) should I use XSP ?
6) Should I use direct programming langages ?
7) Should I change the structure of the XML input and how ?

etc.

Of course there is a awful way to do that with

and $name could be "a" or "span" for exemple

<xsl:variable name="name">
  <xsl:choose>
    <xsl:when test="@LINKED=='true'">a</xsl:when>
    <xsl:otherwise>span</xsl:otherwise>
  </xsl:choose>
</xsl:variable>

<xsl:element name="{$name}">
  <xsl:if test="$name == a">
    <xsl:attribute name="href" select="$href" />
  </xsl:if>
   content
</xsl:element>

Cheers

Xmlizer


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to