Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

XML/XLT: Teilbaum in Variable

Empfohlene Antworten

Veröffentlicht

Hallo,

ich habe ein Problem mit XML-Transformationen.

Ich möchste einen Teilbaum in einer Variable speichern um den Inhalt später wieder lesen zu können.

Es funktioniert aber überhaupt nicht. Die Fehlermeldung ist immer

>>

ERROR: Description: Expression must evaluate to a node-set.

-->$data<--/message

<<

Ich verstehe den Fehler nicht. Ich copiere doch einen Node-set (wege copy-of anstatt value-of)

Wieos kann ich dann nicht auf die Unterelemente zugreifen.

Anmerkung: Der Zugriff auf die Variable selbst funktioniert.

Bisher habe ich soetwas:

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:output method="xml" />

<xsl:variable name="currenttype" select="'idoc'"/>

<xsl:variable name="currentclient" select="/content/rule-result/client"/>

<xsl:variable name="data">

<xsl:for-each select="/content/datasource/client">

<xsl:if test="./name=$currentclient">

<xsl:if test="type=$currenttype">

<xsl:copy-of select="."/> </xsl:if>

</xsl:if>

</xsl:for-each>

</xsl:variable>

<xsl:template match="/">

<test><xsl:value-of select="$data/message"/></test>

</xsl:template>

</xsl:stylesheet>

Die XML-Datei sieht so aus:

<content>

<!--cut-->

<datasource>

<client>

<name>218</name>

<type>bim</type>

<mail>a@a.de</mail>

<message>Nachricht1</message>

</client>

<client>

<name>218</name>

<type>idoc</type>

<mail>b@b.de</mail>

<mail>c@c.de</mail>

<message>Nachricht2</message>

</client>

<client>

<name>201</name>

<type>idoc</type>

<mail>d@d.de</mail>

<message>Nachricht3</message

</client>

</datasource>

</content>

Kann mir irgendwer helfen?

:confused:

Wie?

So?

<xsl:variable name="data" select="/content/datasource/client">

Das funktioniert?

Nein, sitze im Moment in einem anderen Projekt.

Ich benutze Xalan.

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.