![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - textstring as atributes in xsl >Thread Next - Re: textstring as atributes in xsl Re: textstring as atributes in xslTo: 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/ | ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
