xsl-list
[Top] [All Lists]

Re: [xsl] AVT use and doc() function in xslt 2.0?

2011-08-18 14:34:33
On Thu, August 18, 2011 8:19 pm, dvint(_at_)dvint(_dot_)com wrote:
...
I have even gone as far as putting the value into a variable and then
referencing the variable:

<xsl:variable select="'GAASIB0'" name="modelic"/>
<xsl:copy-of
select="doc('dmcmapping.xml')/searchReplace/smodelic[@val='{$modelic}']"/>


What am I missing?

It's not so much what you're missing as what you have extra.  Try:

<xsl:variable select="'GAASIB0'" name="modelic"/>
<xsl:copy-of
select="doc('dmcmapping.xml')/searchReplace/smodelic[@val=$modelic]"/>

The XSLT spec (and, consequently, Mulberry's XSLT quick reference [1]) has
'{' and '}' in the prototypes of attributes where AVTs are meaningful.

Based on your example, you should also be able use 'current()' [2] to do:

<xsl:copy-of
select="doc('dmcmapping.xml')/searchReplace/smodelic[@val=current()/modelic]"/>

Regards,


Tony Graham                                   tgraham(_at_)mentea(_dot_)net
Consultant                                 http://www.mentea.net
Mentea       13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
 --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
    XML, XSL FO and XSLT consulting, training and programming

[1] http://www.mulberrytech.com/quickref/index.html
[2] http://www.w3.org/TR/xslt20/#current-function

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--