[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Understanding named templates and their parameters
Michel Goossens wrote: > > <xsl:template name="listitem"> > <xsl:param-variable name="labeltext">labeltext</xsl:param-variable> > <xsl:param-variable name="itemid">itemid</xsl:param-variable> > <xsl:param-variable name="itemtext">itemtext</xsl:param-variable> > <fo:list-item id="{$itemid}"> > <fo:list-item-label font-style="italic"> > $labeltext<xsl:text>:</xsl:text> Character data in a template is copied straight through to the result; nothing is done with it beyond normal XML parsing. $labeltext is an expression; you want to put the string value of the expression into the result. The way to do that is to use xsl:value-of: <xsl:value-of select="$labeltext"/> > </fo:list-item-label> > <fo:list-item-body> > <xsl:value-of select="$itemtext"/> > </fo:list-item-body> > </fo:list-item> > </xsl:template> > > <xsl:template match='/'> > <fo:page-sequence> > <xsl:apply-templates/> > </fo:page-sequence> > </xsl:template> > > <xsl:template match="invitation"> > <fo:list-block> > <xsl:call-template name="listitem"> > <xsl:param name="labeltext">To</xsl:param> > <xsl:param name="itemid">listto</xsl:param> > <xsl:param name="itemtext">to</xsl:param> This defines the parameter "itemtext" to have a value that's a result tree fragment containing a single text node with the characters "to". Thus when you do <xsl:value-of select="$itemtext"/> you will insert the characters "to". What you need is a parameter whose value is a node-set containing the "to" child of the invitation. You get that with: <xsl:param name="itemtext" expr="to"/> You could alternatively do: <xsl:param name="itemtext"><xsl:value-of select="to"/></xsl:param> That would give you a parameter that was a result tree fragment consisting of a text node whose value was the content of the "to" child of the invitation. James XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|