首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在xslt中从excel表中获取键的对应值

如何在xslt中从excel表中获取键的对应值
EN

Stack Overflow用户
提问于 2019-02-04 18:15:21
回答 1查看 18关注 0票数 0

我有一个包含图像标记的xml,我需要首先获取图像名称,这里是s00122.png。然后有一个excel表格,其中有对应于src图像的href。然后我们需要提取href并用href属性替换src。

输入:

代码语言:javascript
复制
<content type="text/html" title="begin"><body>
<p>
<strong>begin</strong>&#8212;Display the command output beginning with the line that contains the specified string. The string is case-sensitive.</p>
 <div mt-section-origin="Product_Documentation/Command_Reference/Command_Filters_for_CLI_Operational_Commands/begin" class="mt-section" id="section_1"><span id="Command_Syntax"></span>
 <h2 class="editable">Command Syntax</h2>
 <img alt="s00122.png" class="internal default" src="https://sdwan-docs.cisco.com/@api/deki/files/1455/s00122.png?revision=6"/>

 <p><strong>begin</strong> <em>string</em></p> </div>

 </body>
 </content>

输出将为:

代码语言:javascript
复制
<content type="text/html" title="begin"><body>
    <p>
    <strong>begin</strong>&#8212;Display the command output beginning with the line that contains the specified string. The string is case-sensitive.</p>
     <div mt-section-origin="Product_Documentation/Command_Reference/Command_Filters_for_CLI_Operational_Commands/begin" class="mt-section" id="section_1"><span id="Command_Syntax"></span>
     <h2 class="editable">Command Syntax</h2>

     <image href="ashttp://rtp-aspw-ccms1.cisco.com/astoria/_id_0000001aWIA40058D40GYZ_368137.jpg"/>

     <p><strong>begin</strong> <em>string</em></p> </div>

     </body>
     </content>

实现这一目标的最好方法是什么?请提个建议。

EN

回答 1

Stack Overflow用户

发布于 2019-02-04 21:03:52

从XML中获取属性值:您可以使用XPath来获取中特定属性的值。有关如何做到这一点的详细信息,请参阅SO Post How to get attribute value using XPath in Java?

有很多库可以让你读取excel文件。我建议使用Apache POI HSSF。有关如何阅读excel表格的详细信息,请参阅另一篇文章How to read and write excel file。我建议在应用程序初始化时读取excel表,并缓存这些值以获得更好的性能。

希望这能有所帮助。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54513983

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档