XPath/Schematron equivalent of "xsl:value-of"

358 views Asked by At

I built a schematron pattern and found an unexpected error.

I tried to compair a string (e.g. "Robinson 1983") to the output of an xsl function. My function works like this

<xsl:value-of select="surname"/><xsl:text> </xsl:text><xsl:value-of select="year"/>

So, in schematron

test="'Robinson 1983' = ...function-call..."

gave back "false" because the output of the function is a sequence consisting of three text elements.

I was able to fix that using xslt

<xsl:variable name="output"><xsl:value-of select="...function-call..."/></xsl:variable>

and

test="'Robinson 1983' = $output"

gave back "true" as expected.

But I'm wondering: How is this the be solved in "pure" Schematron/XPath? Is there any equivalent to xsl:value-of? I.e. turning a sequence into a string, getting rid of other content. I think this is one of the most import things you want to do in XPath, but I didn't find a solution.

1

There are 1 answers

1
MrMohr On

I tried to recreate your example, but it worked perfectly for me just as you had it coded first.

I suspect that the function using your first select statement:

<xsl:value-of select="surname"/><xsl:text> </xsl:text><xsl:value-of select="year"/>

is returning those combined values as a single string, but your data may actually contain multiple sets of (surname year) strings.

Is is possible that your data contains multiple sets of (surname year) strings? Maybe your function is inadvertently returning more that one set at a time.