我需要使用 XSLT 将 X(A)ML 转换为 XHTML。
以下是 XAML 输入数据:
<Section>
<Paragraph>
<Span Text="plain 1 " />
<Span Text="bold" FontWeight="bold" />
<Span Text=" plain 2 " />
<Span Text="italic" FontStyle="italic" />
<Span Text=" plain3 " />
<Span Text="underline" UnderlineDecoration="line" />
<Span Text="Bold" FontWeight="bold" />
</Paragraph>
<Paragraph>
<Span Text="plain " />
<Span Text="Italic" FontStyle="italic" />
<Span Text=" plain " />
</Paragraph>
<Paragraph>
<Span Text="BoldItalic" FontWeight="bold" FontStyle="italic" />
</Paragraph>
<Paragraph>
<Span Text="plain " />
<Span Text=" Bold " FontWeight="bold" />
<Span Text=" BoldItalic " FontWeight="bold" FontStyle="italic" />
<Span Text=" BoldItalicUnderline " FontWeight="bold" FontStyle="italic" UnderlineDecoration="line" />
<Span Text=" BoldItalic " FontWeight="bold" FontStyle="italic" />
<Span Text=" Bold " FontWeight="bold" />
<Span Text=" plain " />
</Paragraph>
<Paragraph>
<Span Text="plain " />
<Span Text="BoldItalicUnderline " FontWeight="bold" FontStyle="italic" UnderlineDecoration="line" />
<Span Text=" plain " />
</Paragraph>
<Paragraph>
<Span Text="plain " />
<Span Text="Bold " FontWeight="bold" />
<Span Text=" Bold and Italic " FontWeight="bold" FontStyle="italic" />
<Span Text=" Bold and Italic and Underline " FontWeight="bold" FontStyle="italic" UnderlineDecoration="line" />
<Span Text=" Bold and Italic " FontWeight="bold" FontStyle="italic" />
<Span Text=" Bold " FontWeight="bold" />
<Span Text=" plain " />
</Paragraph>
</Section>
使用 XSLT 作为输出的预期 XHTML 数据:
<QuestionText xml:space="preserve">
<p>plain 1 <b>bold</b> plain 2 <i>italic</i> plain3 <u>underline</u><b>Bold</b></p>
<p>plain <i>Italic</i> plain </p>
<p><b><i>BoldItalic</i></b></p>
<p>plain <b> Bold <i> BoldItalic <u> BoldItalicUnderline </u> BoldItalic </i> Bold </b> plain </p>
<p>plain <b><i><u>BoldItalicUnderline </u></i></b> plain </p>
<p>plain <b>Bold <i> Bold and Italic <u> Bold and Italic and Underline </u> Bold and Italic </i> Bold </b> plain </p>
</QuestionText>
我不知道如何将所有跨度(兄弟)节点转换为一个父节点。
非常感谢 XSLT 将上述 XAML 转换为 XHTML 的任何帮助。