Subject: Re: [xsl] Filtering, xslt 2.0 From: "Alan Painter alan.painter@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Tue, 1 Nov 2022 08:53:34 -0000 |
It appears the second option is working from bash. You simply need to change the param definition in the stylesheet. <xsl:param name="types" as="xs:string*"/> (i.e. add the asterisk "*" to have a sequence of strings) On Tue, Nov 1, 2022, 09:44 Dave Pawson dave.pawson@xxxxxxxxx < xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote: > I suspect it is a shell issue (Using Bash on Linux) > Test case > <?xml version="1.0" encoding="utf-8"?> > <set> > > <data> > <name>A</name> > <type>dog</type> > </data> > <data> > <name>B</name> > <type>cat</type> > </data> > <data> > <name>C</name> > <type>mouse</type> > </data> > </set> > > <?xml version="1.0" encoding="utf-8"?> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:d="http://www.dpawson.co.uk/ns#" > xmlns:xs="http://www.w3.org/2001/XMLSchema" > version="2.0"> > > <xsl:param name="types" as="xs:string"/> > > <xsl:strip-space elements="*"/> > > <xsl:template match="set"> > > <xsl:message> > <xsl:value-of select='$types'/> > </xsl:message> > > > <xsl:for-each select="data"> > <xsl:sort select="name"/> > <xsl:apply-templates/> > </xsl:for-each> > </xsl:template> > > > <xsl:template match="data"> > <xsl:if test="type = $types"> > <xsl:apply-templates mode="pass"/> > </xsl:if> > <xsl:if test="contains(concat(',', $types, ','), concat(',', type, > ','))"> > <xsl:message> > <xsl:value-of select="'Dimitre'"/> > </xsl:message> > </xsl:if> > </xsl:template> > > > <xsl:template match="name|type" /> > > <xsl:template match="name|type" mode="pass"> > <xsl:apply-templates/> > </xsl:template> > > > <xsl:template match="*"> > <xsl:message> > *****<xsl:value-of select="name(..)"/>/{<xsl:value-of > select="namespace-uri()"/>}<xsl:value-of select="name()"/>****** > </xsl:message> > </xsl:template> > > > > </xsl:stylesheet> > > 1. sax2 seq.xml seq.xsl op.xml ?types='("A", "B")' > Errors with Unrecognized option: "B") > > 2. sax2 seq.xml seq.xsl op.xml ?types="('A','B')" > XPTY0004: A sequence of more than one item is not allowed as the value > of variable $types > ("A", "B") > > Saxon version PE 9.6.0.1 > > > Suggestions to get the data into the stylesheet please? An external xml > file? > > > TiA > > regards > > > > -- > Dave Pawson > XSLT XSL-FO FAQ. > Docbook FAQ.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Filtering, xslt 2.0, Wendell Piez wapiez@ | Thread | [xsl] XSL-List Guidelines, B Tommie Usdin btusd |
Re: [xsl] Filtering, xslt 2.0, Martin Honnen martin | Date | Re: [xsl] Filtering, xslt 2.0, Dave Pawson dave.paw |
Month |