Schematron: Element within mixed-type element only with other content

My XML Data should look like this:




  <element_in_question>...some content...</element_in_question>



What I want to make sure using Schematron is that the "element_in_question" may only appear within "mixed_type_parent" if there is some text outside of the "element_in_question". That means

  <element_in_question>...some content...</element_in_question>

is not allowed and should cause an error.

I tried to get the string-length of all text immediately within "mixed_type_parent"

string-length(replace(ancestor::mixed_type_parent[1]/text(),' ', ''))

But, again, there is one of the most annoying errors in XPath: "A sequence of more than one item is not allowed as the first argument of replace()"

In XSLT I have solved this problem by the simplest function you can think about:

<xsl:function name="locfun:make_string">
 <xsl:param name="input_sequence"/>
 <xsl:value-of select="$input_sequence"/>

(It is really a shame that there seams to be no such built-in function in XPath.)

But how can I use this function in Schematron? I didn't find a solution for this.

And other than that: How do I get all text form all other childs of "mixed_type_parent" except "mixed_type_parent"?


Try this:


For your second question: How do I get all text form all other childs of "mixed_type_parent" except "mixed_type_parent"?


considering this input XML,

    <element_in_question>...some content...</element_in_question>

when this XSLT is applied:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl=""

<xsl:strip-space elements="*"/>

    <xsl:template match="element_in_question">
            <xsl:when test="preceding-sibling::text() or following-sibling::text()">




Need Your Help

Unable to authenticate with Twitter using Twitter4j on Android

android twitter twitter4j

So, I'm getting a 'No authentication challenges found' error when trying to authenticate through Twitter. And before you ask, yes, I've googled the issue; there were only three pages of results, an...

<MailSettings> Use deliveryMethods 'Network' and 'SpecifiedPickupDirectory' simultaneously .net email smtpclient configurationmanager

Exactly as it says on the tin: is it possible to specify both delivery methods in a single configuration? I'd figure it'd be a quick (and cheap) solution to log all e-mail messages that were sent