I need to make XSLT which will generete json.
The problem is that i have <
and >
symbols in my xml which need to be replaced with <> in output. But disable-output-escaping="yes" makes line break, can i remove this line break?
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>
Output which I need
{
"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>
Output
{
"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>;"
}