Это в продолжение моих предыдущих вопросов (извините за повторную публикацию аналогичного типа вопроса):
Объединение функций двух файлов xsl в один файл (не проблема с импортом или включением xsl)
и
Объединение функций двух файлов xsl в один файл (продолжение.....)
На самом деле это небольшая манипуляция с моим вторым вопросом. Теперь мне нужно объединить решение, предоставленное Flack, с моим первым вопросом с условием «выбрать» в моем xsl:
<xsl:choose>
<xsl:when test='/Declaration/Header/DeclarantsReference = ""'>
<DeclarantsReference>
<xsl:text disable-output-escaping="no">A</xsl:text>
</DeclarantsReference>
</xsl:when>
<xsl:otherwise>
<DeclarantsReference>
<xsl:value-of select="/Declaration/Header/DeclarantsReference"/>
</DeclarantsReference>
</xsl:otherwise>
</xsl:choose>
Теперь любой пример ввода xml, например:
<Declaration>
<Message>
<Meduim>#+#</Meduim>
<CommonAccessReference></CommonAccessReference>
</Message>
<BeginingOfMessage>
<MessageCode>5</MessageCode>
<DeclarationCurrency></DeclarationCurrency>
<MessageFunction>ISD</MessageFunction>
</BeginingOfMessage>
<Header>
<DeclarantsReference></DeclarantsReference>
<Items>
<Documents>
<ItemDocument>
<DocumentCode>XXX</DocumentCode>
<DocumentPart></DocumentPart>
<DocumentLanguage>#+#</DocumentLanguage>
</ItemDocument>
</Documents>
</Items>
</Header>
</Declaration>
должен вывести:
<Declaration>
<Message>
<Meduim></Meduim>
</Message>
<BeginingOfMessage>
<MessageCode>5</MessageCode>
<MessageFunction>ISD</MessageFunction>
</BeginingOfMessage>
<Header>
<DeclarantsReference>A</DeclarantsReference>
<Items>
<Documents>
<ItemDocument>
<DocumentCode>XXX</DocumentCode>
<DocumentLanguage></DocumentLanguage>
</ItemDocument>
</Documents>
</Items>
</Header>
</Declaration>
Спасибо за любую помощь заранее.