jsonを生成するXSLTを作成する必要があります。
問題は、出力で<>に置き換える必要のあるシンボルがxmlにあることです<
。>
しかし、disable-output-escaping = "yes"は改行しますが、この改行を削除できますか?
XML:
<item id="166" group="0">
<name>Some Titile</name>
<text><p>A dizzying array of deep, robust color, the Hugs and Kisses bouquet contains one dozen tulips and one dozen iris, fresh from the fields. It's an always-impressive bouquet perfect for a "dinner for two," a special someone's birthday, or anytime you want to make someone's heart race.</p></text>
</item>
必要な出力
{
"name": "Some Title",
"text": "<p>A dizzying array of deep, robust color, the Hugs and Kisses bouquet contains one dozen tulips and one dozen iris, fresh from the fields. It's an always-impressive bouquet perfect for a "dinner for two," a special someone's birthday, or anytime you want to make someone's heart race.</p>;"
}
XSLT
<?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" encoding="UTF-8"/>
<xsl:template match="item">
{
"name": "<xsl:value-of select="name" />",
"text": "<xsl:value-of select="text" />"
}
</xsl:template>
</xsl:stylesheet>
出力
{
"name": "Some Title",
"text": "<p>A dizzying array of deep, robust color, the Hugs and Kisses bouquet contains one dozen tulips and one dozen iris, fresh from the fields. It's an always-impressive bouquet perfect for a "dinner for two," a special someone's birthday, or anytime you want to make someone's heart race<./p>;"
}