Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: textstring as atributes in xsl

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 4/1/2005 1:14:00 PM

Joachim Weiß wrote:


> does anybody know a simple solution for this XSL-Problem:
> 
> <xsl:param name='controlName'>theName</xsl:param>
> <xsl:param name='otherOptions'><![CDATA[size="5" value="45"]]></xsl:param>
> 
> these parameters shoul result in sth. like
> <input type="text" name="theName" size="5" value="45" />
> 
> the approach is
> 
> <xsl:element name="input>
>     <xsl:attribute name="type">text</xsl:attribute>
>     <xsl:attribute name="name"><xsl:value-of select="$controlName" 
> /></xsl:attribute>
> 
> 
> how do i get my $otherOptions in here?

Obviously with some text stuffed in a CDATA you simply have unstructured 
text which is not suitable to create structured result nodes of it, 
unless you wrote a parser.
Why is it not possible for you to continue as with the other parameters, 
e.g.
   <xsl:with-param name="size" select="5" />
   <xsl:with-param name="value" select="45" />
then you could simply use those parameters as you have done with the 
other parameters.

There are also ways in XSLT to predefine attribute sets e.g.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   version="1.0">

<xsl:output method="xml" />

<xsl:attribute-set name="defaultSize">
   <xsl:attribute name="size">5</xsl:attribute>
</xsl:attribute-set>

<xsl:attribute-set name="defaultValue">
   <xsl:attribute name="value">45</xsl:attribute>
</xsl:attribute-set>

<xsl:attribute-set name="defaultSizeAndValue"
   use-attribute-sets="defaultSize defaultValue" />

<xsl:template match="/">
   <results>
     <xsl:call-template name="example">
       <xsl:with-param name="controlName" select="'theName'" />
     </xsl:call-template>
   </results>
</xsl:template>

<xsl:template name="example">
   <xsl:param name="controlName" />
   <input type="text" name="{$controlName}"
     xsl:use-attribute-sets="defaultSizeAndValue"></input>
</xsl:template>

</xsl:stylesheet>

although that will not help you as far as I can see if you want to pass 
specific parameter values when calling a template.

-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent