07/01/25 01:58:41
~続きです~ 以下のように書いてみたのですが、テキストと区切りが別々になってしまいます。
<?xml version="1.0" encoding="Shift_JIS" ?><xsl:stylesheet xmlns:xsl="URLリンク(www.w3.org) version="1.0">
<xsl:output method="xml" encoding="utf-8" /><xsl:template match="/"><xsl:apply-templates /></xsl:template>
<xsl:template match="article">
<xsl:element name="html">
<xsl:element name="head">
<xsl:element name="title">
<xsl:value-of select="title" />
</xsl:element>
</xsl:element>
<xsl:element name="body">
<xsl:for-each select="../*">
<xsl:apply-templates select="text()"/>
<xsl:apply-templates select="photo"/>
</xsl:for-each>
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template match="text()">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="photo">
<xsl:element name="img">
<xsl:attribute name="src">
<xsl:value-of select="@file" />
</xsl:attribute>
</xsl:element>
</xsl:template>
</xsl:stylesheet> ~続きます~