|
next
|
Subject: make sequence II Author: Geoffrey Nutting Date: 19 Aug 2007 10:13 PM
|
Hi,
I'm trying to figure out how to construct sequences from lists, but don't seem to be able to light on the right tool. Along the way,I've run into a couple of other features whose implementation I was wondering about:
Basically, if I have a list
<fl><fid>fida</fid><fid>fidb</fid><fid>fidc</fid><fid>fidd</fid><fid>fide</fid></fl>
I would like to be able to generate the sequence:
('fida','fidb','fidc','fidd','fide')
i.e., a list of text values of each of the elements.
Along the way, I have come to wonder (not understand):
a) what is the purpose of xsl:sequence
b) does xsl:value of have a 'separator' attribute
c) does xsl:variable have an 'as' attribute
in Stylus Studio? (build 894k)
I became aware of several of these on the Saxon homepage, XSLT Elements
Thank you,
Jeff Nutting
|
next
|
Subject: make sequence II Author: Geoffrey Nutting Date: 20 Aug 2007 06:45 PM
|
Hi,
Thanks to your comments, I got a test program to run reasonably smoothly
<?xml version='1.0'?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<f>
<xsl:variable name="tempa">
<xsl:value-of select="'a1','a2','a3'"/>
</xsl:variable>
<xsl:variable name="tempb" as="item()*">
<xsl:sequence select="'c1','c2','c3'"/>
</xsl:variable>
<a><xsl:value-of select="$tempa[1]"/></a>
<b><xsl:value-of select="$tempb[1]"/></b>
<cp><xsl:copy /></cp>
<d><xsl:copy-of select="$tempb"/></d>
<all><xsl:value-of select="$tempb"/></all>
<xsl:variable name="tempc" as="item()*">
<xsl:sequence select="'c1','c2','c3'"/>
</xsl:variable>
<c><xsl:value-of select="$tempc[1]"/></c>
</f>
</xsl:template>
</xsl:stylesheet>
but when I put a separator attribute on the copy-of statement, it fails
with the message
at: file:///c:/film/film_ws/makseq80.xsl 17
java.lang.RuntimeException: Error: at xsl:copy-of on line 17 of file:///c:/film/film_ws/makseq80.xsl:
XTSE0090: Attribute @separator is not allowed on element <xsl:copy-of>
at com.exln.stylus.CSaxon8Driver.doProcessing(CSaxon8Driver.java:258)
at com.exln.stylus.CProcessorDriver.process(CProcessorDriver.java:111)
makseq80.xsl (17, 1)
Error: at xsl:copy-of on line 17 of file:///c:/film/film_ws/makseq80.xsl: XTSE0090: Attribute @separator is not allowed on element <xsl:copy-of>
believe I am using the Saxon 8.9.x processor, & that there is an optional separator attribute on it: what's the status of it in Stylus Studio?
Thanks,
Jeff Nutting
|
|
|
|