How to surround an element with efficacity ?

xmlizer <[email protected]>
Newsgroups gmane.text.xml.general
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.