xslt如何根据其他标记的属性值更改标记的属性值

时间:2017-11-15 03:48:24

标签: xml xslt xpath xslt-1.0

我有以下输入xml。 现在我只想在数据标签的名称=" Doctype"中更改第一个topicref的输出类。对于那个值="数据表"或" databrief"。

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE bookmap
  PUBLIC "-//OASIS//DTD DITA BookMap//EN" "bookmap.dtd">
<bookmap xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/"
         domains="(map bookmap) class="- map/map bookmap/bookmap ">
   <booktitle class="- topic/title bookmap/booktitle ">
      <mainbooktitle class="- topic/ph bookmap/mainbooktitle ">STD10NM60ND, STF10NM60ND, STP10NM60ND</mainbooktitle>
      <booktitlealt class="- topic/ph bookmap/booktitlealt ">N-channel 600 V, 0.57 Ω typ., 8 A, FDmesh™ II Power MOSFETs in DPAK, TO-220FP and TO-220 packages</booktitlealt>
   </booktitle>
   <bookmeta class="- map/topicmeta bookmap/bookmeta ">
      <data name="DocType" value="Datasheet" class="- topic/data "/>
      <data name="ProductStatusFootnote"
            value="This is information on a product in full production."
            class="- topic/data "/>
      <data name="ProductStatus"
            value="Datasheet - production data"
            class="- topic/data "/>
      <data name="Application" value="" class="- topic/data "/>
                <data name="AuthorName" value="" class="- topic/data "/>
      <data name="Technology" value="" class="- topic/data "/>
      <data name="Package option" value="" class="- topic/data "/>
      <data name="DxParentInfo" value="" class="- topic/data "/>
   </bookmeta>
   <frontmatter toc="no" class="- map/topicref bookmap/frontmatter ">
      <topicref navtitle="@NA"
                toc="no"
                class="- map/topicref "
                href="../Topics/DPAK_TO-220_TO-220FP_coverIMAGE_silhouette.dita">
         <topicmeta class="- map/topicmeta ">
            <linktext class="- map/linktext ">Cover image</linktext>
            <searchtitle class="- map/searchtitle ">Cover image</searchtitle>
         </topicmeta>
      </topicref>
      <topicref navtitle="@NA"
                toc="no"
                class="- map/topicref "
                outputclass="Dx:CoverPage"
                href="../Topics/AM01475v1_internalSCHEMATIC_TAB_noZEN.dita">
         <topicmeta class="- map/topicmeta ">
            <linktext class="- map/linktext ">Internal schematic diagram</linktext>
            <searchtitle class="- map/searchtitle ">Internal schematic diagram</searchtitle>
         </topicmeta>
      </topicref>
      <topicref navtitle="Features"
                toc="no"
                class="- map/topicref "
                href="../Topics/STP10NM60ND_featuresTABLE.dita">
         <topicmeta class="- map/topicmeta ">
            <linktext class="- map/linktext ">Features table</linktext>
            <searchtitle class="- map/searchtitle ">Features table</searchtitle>
         </topicmeta>
      </topicref>
      <topicref navtitle="@NA"
                toc="no"
                class="- map/topicref "
                href="../Topics/PMOS_FDmesh_II_features.dita">
         <topicmeta class="- map/topicmeta ">
            <linktext class="- map/linktext ">Features</linktext>
            <searchtitle class="- map/searchtitle ">Features</searchtitle>
         </topicmeta>
      </topicref>


             </frontmatter>
   <chapter href="DocID18467_STP10NM60ND.ditamap"
            format="ditamap"
            class="- map/topicref bookmap/chapter "/>
   <backmatter class="- map/topicref bookmap/backmatter ">
      <amendments class="- map/topicref bookmap/amendments "
                  href="../Topics/STP10NM60ND_revHIST.dita"/>
      <notices href="../../../../../../Corporate/Migration/disclaimer_PUBLIC.dita"
               locktitle="yes"
               navtitle="@NA"
               class="- map/topicref bookmap/notices "/>
   </backmatter>
</bookmap>

感谢请使用xslt建议一些解决方案。我能够选择前端的第一个topicref,但不知道在其中放置其他条件的位置和方式。

0 个答案:

没有答案
相关问题