string - Schematron: Element within mixed-type element only with other content -
my xml data should this:
<mixed_type_parent> ...text... <other_element1/> <other_element2/> <element_in_question>...some content...</element_in_question> <other_element2>...text...</other_element2> <other_element1>...text...</other_element1> ...text... </mixed_type_parent>
what want make sure using schematron "element_in_question" may appear within "mixed_type_parent" if there text outside of "element_in_question". means
<mixed_type_parent> <element_in_question>...some content...</element_in_question> </mixed_type_parent>
is not allowed , should cause error.
i tried string-length of text within "mixed_type_parent"
string-length(replace(ancestor::mixed_type_parent[1]/text(),' ', ''))
but, again, there 1 of annoying errors in xpath: "a sequence of more 1 item not allowed first argument of replace()"
in xslt have solved problem simplest function can think about:
<xsl:function name="locfun:make_string"> <xsl:param name="input_sequence"/> <xsl:value-of select="$input_sequence"/> </xsl:function>
(it shame there seams no such built-in function in xpath.)
but how can use function in schematron? didn't find solution this.
and other that: how text form other childs of "mixed_type_parent" except "mixed_type_parent"?
try this:
string-join(ancestor::mixed_type_parent[1]/text(),'')=''
for second question: how text form other childs of "mixed_type_parent" except "mixed_type_parent"?
/mixed_type_parent/*[not(self::element_in_question)]/text()
Comments
Post a Comment