<xsl:for-each select="document('mySkus.xml')/skus">
there is only one item selected here, didn't you intend t iterate over
all the sku elements
<xsl:for-each select="document('mySkus.xml')/skus/sku">
?
<xsl:if test="starts-with('.', $skus)">
this is testing if the string "." contais anything saxon is telling you
the second parameter needs to be a single item but you presumably don't
want to test the string ".", you could test . which would select the
skus element but that is effectively your entire document 9ignoring all
markup) so I think you do want the for-each to go over skus/sku and then
to use . here to test each sku.
You could then use
$skus[starts-with(current(),.)]
to test if the current sku node starts aith any of the items in $sku.
(your input document is not well formed, which makes it harder to test
(--- in comments)
something like this:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs"
version="2.0" >
<xsl:key name="sku" match="knowledge/part" use="code" />
<xsl:variable name="skus" as="xs:string*"
select="distinct-values(/knowledge/part/code)" />
<xsl:variable name="root" select="/"/>
<xsl:template match="/">
<html>
<head>
<title>Test Document</title>
</head>
<body>
<H1>Executive Summary</H1>
<p>Your proposal includes
<xsl:value-of
select="for $s in $skus return
key('sku',$s[document('mySkus.xml')/skus/sku[starts-with(.,$s)]],$root)/name"
separator=", "/>
</p>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
$ saxon9 k.xml k.xsl
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test Document</title>
</head>
<body>
<H1>Executive Summary</H1>
<p>Your proposal includes
Cisco phones, Cisco routers, Cisco switches
</p>
</body>
</html>
________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs.
________________________________________________________________________
--~------------------------------------------------------------------
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>
--~--