xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xmlizer <mo...@netcourrier.com>
Subject How to surround an element with efficacity ?
Date Mon, 08 Nov 2004 11:35:38 GMT
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: general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org


Mime
View raw message