如何使用XSLT将此xml文件转换为Target xml文件 [英] How to convert this xml file into Target xml file using XSLT

查看:84
本文介绍了如何使用XSLT将此xml文件转换为Target xml文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

b $ b $
我无法将子问题放在相应的问题中。请任何人建议我如何实现这一目标。这对我来说是非常迫切的要求。请帮助.....

 

 实际要求是我需要将word文档转换为特定的xml格式。所以我将单词doc保存为word-xml2003并尝试使用xslt将其转换为目标xml
格式。由于这些文件很大,我制作了一个我发布的样本格式。 
$


我们可以通过Paranthesis来区分问题和子问题。以paranthesis开头的数据是一个子问题。 
$


我必须使用xslt 1.0






这是输入XML文件:

 

 


<?xml version="1.0" encoding="UTF-8"?>
<tables>
  <table>
    <tr>
      <tc>
        <data>
          This is the title of the table.
        </data>
      </tc>
    </tr>
    <tr>
      <tc>
        <data>
          1. Question 
        </data>
      </tc>
    </tr>
    <tr>
      <tc>
        <data>
          2. Question
        </data>
      </tc>
    </tr>
    <tr>
      <tc>
        <data>
          (Subquestion1)
        </data>
      </tc>
    </tr>
    <tr>
      <tc>
        <data>
          (Subquestion2)
        </data>
      </tc>
    </tr>
    <tr>
      <tc>
        <data>
          3. Question
        </data>
      </tc>
    </tr>
    <tr>
      <tc>
        <data>
          (Subquestion1)
        </data>
      </tc>
    </tr>
    <tr>
      <tc>
        <data>
          4. Question
        </data>
      </tc>
    </tr>
  </table>
  <table>
    <tr>
      <tc>
        <data>
          This is the title of the table.
        </data>
      </tc>
    </tr>
    <tr>
      <tc>
        <data>
          1. Question 
        </data>
      </tc>
    </tr>
    <tr>
      <tc>
        <data>
          (Subquestion)
        </data>
      </tc>
    </tr>
    <tr>
      <tc>
        <data>
          (Subquestion)
        </data>
      </tc>
    </tr>
    <tr>
      <tc>
        <data>
          2. Question
        </data>
      </tc>
    </tr>
    <tr>
      <tc>
        <data>
          3. Question
        </data>
      </tc>
    </tr>
    <tr>
      <tc>
        <data>
          (Subquestion)
        </data>
      </tc>
    </tr>
    <tr>
      <tc>
        <data>
          4. Question
        </data>
      </tc>
    </tr>
  </table>
</tables>

推荐答案

你如何区分问题和SubQuestion,因为它的包裹结构似乎相同?此致,MH
How do you distinguish between a Question and SubQuestion because the structure seems to be same under which its wrapped? Regards, MH


这篇关于如何使用XSLT将此xml文件转换为Target xml文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆