N
nobody
hi there!
given
<!ELEMENT a (#PCDATA | x)*>
<!ELEMENT x (#PCDATA)>
how can I find out if x is "embedded" at the beginning
<a><x>xxx</x>aaa</a>
or at the end
<a>aaa<x>xxx</x></a>
or in the middle
<a>aaa<x>xxx</x>bbb</a>
of the content of element a?
what I need to do is to output x according to it's
"position" within a. examples:
<a><x>xxx</x>aaa</a> --> "xxx+aaa"
<a>aaa<x>xxx</x></a> --> "aaa+xxx"
<a>aaa<x>xxx</x>bbb</a> --> "aaa+xxx+bbb"
can any body help me with the two test clauses needed?
<xsl:template match="x">
<xsl:choose>
<xsl:when test="???">
<!-- x at start -->
<xsl:value-of select="."/>
<xsl:text>+</xsl:text>
</xsl:when>
<xsl:when test="???">
<!-- x at end -->
<xsl:text>+</xsl:text>
<xsl:value-of select="."/>
</xsl:when>
<xsltherwise>
<!-- x in the middle -->
<xsl:text>+</xsl:text>
<xsl:value-of select="."/>
<xsl:text>+</xsl:text>
</xsltherwise>
</xsl:choose>
</xsl:template>
thank you very much! andreas (ala_NO@SPAM_context.ch)
given
<!ELEMENT a (#PCDATA | x)*>
<!ELEMENT x (#PCDATA)>
how can I find out if x is "embedded" at the beginning
<a><x>xxx</x>aaa</a>
or at the end
<a>aaa<x>xxx</x></a>
or in the middle
<a>aaa<x>xxx</x>bbb</a>
of the content of element a?
what I need to do is to output x according to it's
"position" within a. examples:
<a><x>xxx</x>aaa</a> --> "xxx+aaa"
<a>aaa<x>xxx</x></a> --> "aaa+xxx"
<a>aaa<x>xxx</x>bbb</a> --> "aaa+xxx+bbb"
can any body help me with the two test clauses needed?
<xsl:template match="x">
<xsl:choose>
<xsl:when test="???">
<!-- x at start -->
<xsl:value-of select="."/>
<xsl:text>+</xsl:text>
</xsl:when>
<xsl:when test="???">
<!-- x at end -->
<xsl:text>+</xsl:text>
<xsl:value-of select="."/>
</xsl:when>
<xsltherwise>
<!-- x in the middle -->
<xsl:text>+</xsl:text>
<xsl:value-of select="."/>
<xsl:text>+</xsl:text>
</xsltherwise>
</xsl:choose>
</xsl:template>
thank you very much! andreas (ala_NO@SPAM_context.ch)