|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Filtering, xslt 2.0
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.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








