This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: xslt, document() Q?
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] xslt, document() Q?
- From: Wendell Piez <wapiez at mulberrytech dot com>
- Date: Thu, 18 Oct 2001 12:20:57 -0400
- Reply-To: xsl-list at lists dot mulberrytech dot com
Jakub,
Yes, this can be done.
At 06:05 PM 10/17/01, you wrote:
> <xsl:template match="addr">
> <xsl:call-template name="translate_v3-v2">
> <xsl:with-param name="tableno">123"</xsl:with-param>
> <!?how to set the value of this parameter to the value of the
>attribute "use"? Is it possible like this? -->
> <xsl:with-param name="v3code" select="@use"/>
Yes, that should do it. Is this not working?
If it's not, it might be the line (higher up)
> <xsl:value-of select="document(concat($dir, 'table', $tableno,
>'.xml'))/table/item[input=$v3code]/output/text()"/>
which is somewhat brittle. The XPath itself looks good (although the final
/text() step is unnecessary), but you need to be careful with the
concat($dir, 'table', $tableno, '.xml')
to make sure it resolves to a file name that will actually be found. It
might need to be
concat($dir, '/table', $tableno, '.xml')
and $dir might need to be '/tables' not 'tables', etc.
I would test it with a literal string before parameterizing this setting,
to make sure the other parts of your stylesheet are working correctly. Then
build the concat step by step -- to debug, you could ask for its value in
your output, just to look at it.
There are ways to improve the efficiency of these operations, but it looks
to me like you've basically figured out how it should work.
Good luck,
Wendell
======================================================================
Wendell Piez mailto:wapiez@mulberrytech.com
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list