Ramnarayan
Programmer
Hi,
I am trying to parse the xsl sheet against this raw data as below:
This is a raw data:
<abs>
<sct>This is the section title</sct>
<p>This is a paragraph</p>
<sct> This is another section Title</sct>
<p>This is a second paragraph</p>
</abs>
Here is the xsl sheet i am using:
<xsl:template match="abs">
<xsl:element name="abstract">
<xsl:apply-templates select="sct"/>
<xsl:apply-templates select="p"/>
</xsl:element>
<!-- abstract -->
</xsl:template>
<xsl:template match="sct">
<xsl:element name="title">
<xsl:apply-templates select="node()"/>
</xsl:element>
</xsl:template>
<xsl:template match="p">
<xsl:element name="p">
<xsl:apply-templates select="node()"/>
</xsl:element>
</xsl:template>
Now the output I am getting by running the xsl sheet on the raw data is as below:
<?xml version="1.0" encoding="utf-8"?>
<abstract><title>This is the section title</title>
<title> This is another section Title</title>
<p>This is a paragraph</p>
<p>This is a second paragraph</p>
</abstract>
Actually what I intended for it to appear is as below:
<?xml version="1.0" encoding="utf-8"?>
<abstract>
<title>This is the section title</title>
<p>This is a paragraph</p>
<title> This is another section Title</title>
<p>This is a second paragraph</p>
</abstract>
Can someone correct me where I am wrong in the xsl sheet so that I can make corrections. Actually this is the first time I am using xsl for processing raw data! Thanks for your help in this matter.
I am trying to parse the xsl sheet against this raw data as below:
This is a raw data:
<abs>
<sct>This is the section title</sct>
<p>This is a paragraph</p>
<sct> This is another section Title</sct>
<p>This is a second paragraph</p>
</abs>
Here is the xsl sheet i am using:
<xsl:template match="abs">
<xsl:element name="abstract">
<xsl:apply-templates select="sct"/>
<xsl:apply-templates select="p"/>
</xsl:element>
<!-- abstract -->
</xsl:template>
<xsl:template match="sct">
<xsl:element name="title">
<xsl:apply-templates select="node()"/>
</xsl:element>
</xsl:template>
<xsl:template match="p">
<xsl:element name="p">
<xsl:apply-templates select="node()"/>
</xsl:element>
</xsl:template>
Now the output I am getting by running the xsl sheet on the raw data is as below:
<?xml version="1.0" encoding="utf-8"?>
<abstract><title>This is the section title</title>
<title> This is another section Title</title>
<p>This is a paragraph</p>
<p>This is a second paragraph</p>
</abstract>
Actually what I intended for it to appear is as below:
<?xml version="1.0" encoding="utf-8"?>
<abstract>
<title>This is the section title</title>
<p>This is a paragraph</p>
<title> This is another section Title</title>
<p>This is a second paragraph</p>
</abstract>
Can someone correct me where I am wrong in the xsl sheet so that I can make corrections. Actually this is the first time I am using xsl for processing raw data! Thanks for your help in this matter.