Я ломаю голову и не могу решить эту проблему элегантным способом с помощью XSL. У меня есть элемент XML с вложенными тегами, создающими заголовок. Для отображения это хорошо. Но при экспорте в поставщика для публикации в Интернете возникает проблема.
См. Элемент:
<headline>
<ln id="U20777523148AQE">FOOD PARCEL</ln>
<ln id="U20777523148kHH">LOOTING</ln>
<ln id="U20777523148buE">HITS THE POOR</ln>
</headline>
Идеальное решение должно выглядеть так:
<headline>
<ln>FOOD PARCEL LOOTING HITS THE POOR</ln>
</headline>
Конечно, количество строк (ln) также может отличаться. От одной строки до нескольких, как показано в примере. Некоторая помощь или указатели были бы очень признательны.
Вот пример не очень хорошей идеи, которая у меня была.
<headline>
<xsl:copy-of select="/doc/story/grouphead[1]/headline/ln[1]/text()"/><xsl:text> </xsl:text>
<xsl:copy-of select="/doc/story/grouphead[1]/headline/ln[2]/text()"/><xsl:text> </xsl:text>
<xsl:copy-of select="/doc/story/grouphead[1]/headline/ln[3]/text()"/><xsl:text> </xsl:text>
<xsl:copy-of select="/doc/story/grouphead[1]/headline/ln[4]/text()"/><xsl:text> </xsl:text>
<xsl:copy-of select="/doc/story/grouphead[1]/headline/ln[5]/text()"/><xsl:text> </xsl:text>
</headline>
Еще немного фона - см. Текущий XSL, в котором преобразование используется.
<doc>
<story>
<grouphead>
<overhead>
<ln>
<xsl:value-of select="/doc/story/grouphead[1]/overhead/ln/text()"/>
</ln>
</overhead>
<headline>
<xsl:copy-of select="/doc/story/grouphead[1]/headline/ln[1]/text()"/>
<xsl:text> </xsl:text>
<xsl:copy-of select="/doc/story/grouphead[1]/headline/ln[2]/text()"/>
<xsl:text> </xsl:text>
<xsl:copy-of select="/doc/story/grouphead[1]/headline/ln[3]/text()"/>
<xsl:text> </xsl:text>
<xsl:copy-of select="/doc/story/grouphead[1]/headline/ln[4]/text()"/>
<xsl:text> </xsl:text>
<xsl:copy-of select="/doc/story/grouphead[1]/headline/ln[5]/text()"/>
<xsl:text> </xsl:text>
</headline>
<subhead>
<ln>
<xsl:value-of select="/doc/story/grouphead[1]/subhead/ln/text()"/>
</ln>
</subhead>
</grouphead>
<text>
<byline>
<author>
<name>
<xsl:value-of select="/doc/story/text/byline/author/name/text()"/>
</name>
<description>
<xsl:value-of select="/doc/story/text/byline/author/description/text()"/>
</description>
</author>
</byline>
</text>
</story>
</doc>