but this is not the whole solution for me, beacause I might have different cases.
Elements like <bold>, <italic> can be there or not. So the only thing I really know is that the element <title> exists and that it has an <tab/>-element or not.
So I would like to have all elements "between" <title>...<tab/> into the resulting element <nummer>, and all the rest into <text>, but: with all possible parents.
Headlines: separate number and title with same parent
Can anyone give me a solution to the following problem?
<root>
<elem1>
<titel><bold>1.<tab/>The text <italic>of the</italic> headline</bold></titel>
</elem1>
<par>...</par>
<par/>
</root>
Should become the following structure (attention: double bold-element):
<root>
<elem1>
<titel>
<nummer><bold>1.</bold></nummer>
<text><bold>The text <italic>of the </italic> headline</bold></text>
</titel>
</elem1>
</root>
Thanks a lot!
You can use this as a starting point (though very specific to your case):
<xsl:template match="elem1"> <elem1> <titel> <nummer> <bold> <xsl:value-of select="titel/bold/text()[1]" /> </bold> </nummer> <text> <bold> <xsl:apply-templates select="titel/bold/tab/following-sibling::text() | titel/bold/tab/following-sibling::*" /> </bold> </text> </titel> </elem1> </xsl:template> <xsl:template match="*"> <xsl:copy> <xsl:apply-templates /> </xsl:copy> </xsl:template>Thanks a lot Chriztian,
but this is not the whole solution for me, beacause I might have different cases.
Elements like <bold>, <italic> can be there or not. So the only thing I really know is that the element <title> exists and that it has an <tab/>-element or not.
This means, that I might have following cases:
<title>1.<tab/>The headline-text</title>
<title>The headline-text</title>
<title><italic>1.</italic><tab/>the headline-text</title>
<title><emph>1.<tab/>the headline-text</emph></title>
<title>1.<footnote>annotaion</footnote><tab/>the headline-text</title>
and so on...
So I would like to have all elements "between" <title>...<tab/> into the resulting element <nummer>, and all the rest into <text>, but: with all possible parents.
punzo
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.