Hallo Leute
immer noch ein Neuling in der XSLT -Welt, suche ich nach einer Lösung aus der aktuellen Ausgabe (unten) die gewünschte Ausgabe (beispiel unten) zu erzeugen. Ich würde mich sehr freuen, wenn mir jemand helfen könnte.
hier die XML, die XSLT und die aktuelle und die gewünschte Ausgaben:
- die XML:
- die XSL:
- aktuelle Ausgabe:
catalog.cd.title
Empire Burlesque
artist
Bob Dylan
country
USA
company
Columbia
price
10.90
year
1985
a.b.msg
test text!
- gewünschte Ausgabe:
catalog.cd.title
Empire Burlesque
catalog.cd.artist
Bob Dylan
catalog.cd.country
USA
catalog.cd.company
Columbia
catalog.cd.price
10.90
catalog.cd.year
1985
a.b.msg
test text!
immer noch ein Neuling in der XSLT -Welt, suche ich nach einer Lösung aus der aktuellen Ausgabe (unten) die gewünschte Ausgabe (beispiel unten) zu erzeugen. Ich würde mich sehr freuen, wenn mir jemand helfen könnte.
hier die XML, die XSLT und die aktuelle und die gewünschte Ausgaben:
- die XML:
Code:
<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="transform1.xsl"?> <catalog> <cd> <title>Empire Burlesque</title> <artist>Bob Dylan</artist> <country>USA</country> <company>Columbia</company> <price>10.90</price> <year>1985</year> <a> <b> <msg>test text!</msg> </b> </a> </cd> </catalog>
Code:
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text" indent="no" encoding="UTF-8"/> <xsl:strip-space elements="*"/> <xsl:template match="root"> <xsl:apply-templates select="*|text()"/> </xsl:template> <xsl:template match="*"> <xsl:value-of select="name()"/> <xsl:if test="not(text())"><xsl:text>.</xsl:text></xsl:if> <xsl:apply-templates/> </xsl:template> <xsl:template match="text()"> <xsl:text> </xsl:text> <xsl:value-of select="."/> <xsl:apply-templates/> <xsl:text> </xsl:text> </xsl:template> </xsl:stylesheet>
catalog.cd.title
Empire Burlesque
artist
Bob Dylan
country
USA
company
Columbia
price
10.90
year
1985
a.b.msg
test text!
- gewünschte Ausgabe:
catalog.cd.title
Empire Burlesque
catalog.cd.artist
Bob Dylan
catalog.cd.country
USA
catalog.cd.company
Columbia
catalog.cd.price
10.90
catalog.cd.year
1985
a.b.msg
test text!
Comment