0

i have one XML file from which i want to generate a simple HTML table from. It seems to ignore my xsl:for-each select. Can't find the reason why the xpath doesn't return anything. What's wrong here?

My Task: Simply map some attributes from the element into the cells of my HTML table. One row per property element.

The XML:

<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion id="1">50.0</apiVersion>
<isExposed>true</isExposed>
<targets>
    <target>lightning__AppPage</target>
    <target>lightning__RecordPage</target>
    <target>lightning__HomePage</target>
</targets>
    <masterLabel>Dummy Name</masterLabel>
<description>Custom table with tree hierarchy support</description>
<targetConfigs>
    <targetConfig>
        <property name="objectName" label="Objekt Name" type="String" description="some dummy text" required="true"  />
        <property name="fields" label="Felder" type="String" description="some dummy text 2" required="true" />
    </targetConfig>
</targetConfigs>
</LightningComponentBundle>

My XSL file:

<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:output method="xml" encoding="utf-8" media-type="text/html"/>
 <xsl:template match="/">
  <table>
    <tr>
        <td>label</td>
        <td>type</td>
        <td>desc</td>
    </tr>
    <xsl:for-each select="/LightningComponentBundle/targetConfigs/targetConfig/property">
        <tr>
            <td><xsl:value-of select="@label"/></td>
            <td><xsl:value-of select="@type"/></td>
            <td><xsl:value-of select="@description"/></td>
        </tr>
    </xsl:for-each>
  </table>
 </xsl:template>
</xsl:stylesheet>
NovumCoder
  • 4,349
  • 9
  • 43
  • 58

0 Answers0