ich vielleicht wissen, dass es zu viele Fragen sind in Bezug zu diesem Thema, aber ich kann immer noch nicht notwendig XPath für meine Anforderung ...XSL unterschiedliche Werte in Xalan Prozessor
Ich habe eine XML-Eingabe wie diese findet:
<?xml version="1.0" encoding="utf-8"?>
<Products>
<product vib="SMS53L08TR">
<template name="PDF_ENLBL_GS_TR_NEWEULBL_FO">
<attr name="ProductSubFamily">Dishwashers</attr>
<attr name="ENERGY_CLASS_2010">EEK_EU_2010.A+</attr>
<attr name="ENERGY_CONS_ANNUAL_2010">290</attr>
<attr name="WATER_CONS_2010">3300</attr>
<attr name="PERF_DRY">TROCKNUNGSKLASSE.A</attr>
<attr name="SETTINGS">12</attr>
<attr name="NOISE">48</attr>
</template>
<template name="pdf.eudatasheet.gs.fo">
<attr name="ProductSubFamily">Dishwashers</attr>
<attr name="CODE">SMS53L08TR</attr>
<attr name="SETTINGS">12</attr>
<attr name="ENERGY_CLASS_2010">EEK_EU_2010.A+</attr>
<attr name="ENERGY_CONS_ANNUAL_2010">290</attr>
<attr name="ENERGY_CONS">1.02</attr>
<attr name="POWER_OFF_MODE_2010">0.10</attr>
<attr name="WATER_CONS_2010">3300</attr>
<attr name="PERF_DRY">TROCKNUNGSKLASSE.A</attr>
<attr name="REF_PRG">VERGLEICHSPROGRAMM.EC</attr>
<attr name="REF_PRG_TEMP">50</attr>
<attr name="CYCLE_TIME">195</attr>
<attr name="DURATION_LEFT_ON_MODE_2010">0</attr>
<attr name="NOISE">48</attr>
<attr name="CONSTR_TYPE">CONSTR_TYPE.Free-standing</attr>
</template>
</product>
<product vib="BM5201EG">
<template name="PDF_ENLBL_GS_TR_OLDLBL_FO">
<attr name="ProductSubFamily">Dishwashers</attr>
<attr name="ENERGY_CLASS">ENERGIEEFFIZIENZKLASSE.A</attr>
<attr name="PERF_CLEAN">REINIGUNGSKLASSE.A</attr>
<attr name="WATER_CONS">17.0</attr>
<attr name="ENERGY_CONS">1.05</attr>
<attr name="PERF_DRY">TROCKNUNGSKLASSE.A</attr>
<attr name="SETTINGS">12</attr>
<attr name="NOISE">57</attr>
</template>
<template name="pdf.eudatasheet.gs.fo">
<attr name="ProductSubFamily">Dishwashers</attr>
<attr name="CODE">BM5201EG</attr>
<attr name="SETTINGS">12</attr>
<attr name="ENERGY_CLASS_2010"/>
<attr name="ENERGY_CONS_ANNUAL_2010"/>
<attr name="ENERGY_CONS">1.05</attr>
<attr name="POWER_OFF_MODE_2010"/>
<attr name="WATER_CONS_2010"/>
<attr name="PERF_DRY">TROCKNUNGSKLASSE.A</attr>
<attr name="REF_PRG">VERGLEICHSPROGRAMM.EC</attr>
<attr name="REF_PRG_TEMP">50</attr>
<attr name="CYCLE_TIME">140</attr>
<attr name="DURATION_LEFT_ON_MODE_2010"/>
<attr name="NOISE">57</attr>
<attr name="CONSTR_TYPE">CONSTR_TYPE.Free-standing</attr>
</template>
</product>
</Products>
auf dieser xML-Eingabe werde ich versuchen, verschiedene Werte von Vorlagen zu erhalten:
<Template>PDF_ENLBL_GS_TR_NEWEULBL_FO</Template>
<Template>pdf.eudatasheet.gs.fo</Template>
<Template>PDF_ENLBL_GS_TR_OLDLBL_FO</Template>
Was ich versuche, scheint richtig zu tun, sondern gibt immer noch alle Werte neben distinct (pdf.eu datasheet.gs.fo scheint zweimal bei der Ausgabe) ... Übrigens ist $ output der Variablenname, der alle xml-Dokumente darin enthält.
<xsl:for-each select="$output//product/template/@name[not(@name = preceding:: *)]">
Was mache ich falsch an diesem XPath? Übrigens, weil wir Xalan-Prozessor wegen der Umgebung, die diese xslt läuft, bleiben müssen, konnte ich keine distinct-values-Funktion von XSLT v2.0 verwenden ...
Vielen Dank für Ihre recht und gültige Antwort. – Hayra