【XML】xmlns, XSLT, RelaxNG, JAXP, etc.【総合】at TECH
【XML】xmlns, XSLT, RelaxNG, JAXP, etc.【総合】 - 暇つぶし2ch401:400
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> ~続きます~


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch