J
Jim
Hi
I'm fumbling through xml and I'm having a problem which I'm sure is easy
to correct. Here's the xml:
<area1>
<name>John</name>
<age>22</age>
</area1>
<area2>
<city>London</city>
<state>OH</state>
</area2>
I want to pull out name/age/city/state. Seems simple, but because I
have another element (is that the correct term?) area2, things get all
munged up. Like I said, this is very simple. Here's my xsl:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="text"/>
<xsl:template match="area1">
<xsl:value-of select="name"/>
<xsl:value-of select="age"/>
</xsl:template>
<xsl:template match="area2">
<xsl:value-of select="city"/>
<xsl:value-of select="state"/>
</xsl:template>
When I try and apply this I get an error:
% xsltproc test.xml test.xsl
test.xml:6: parser error : Extra content at the end of the document
<area2>
^
cannot parse test.xml
What am I doing wrong?
Thanks!
I'm fumbling through xml and I'm having a problem which I'm sure is easy
to correct. Here's the xml:
<area1>
<name>John</name>
<age>22</age>
</area1>
<area2>
<city>London</city>
<state>OH</state>
</area2>
I want to pull out name/age/city/state. Seems simple, but because I
have another element (is that the correct term?) area2, things get all
munged up. Like I said, this is very simple. Here's my xsl:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="text"/>
<xsl:template match="area1">
<xsl:value-of select="name"/>
<xsl:value-of select="age"/>
</xsl:template>
<xsl:template match="area2">
<xsl:value-of select="city"/>
<xsl:value-of select="state"/>
</xsl:template>
When I try and apply this I get an error:
% xsltproc test.xml test.xsl
test.xml:6: parser error : Extra content at the end of the document
<area2>
^
cannot parse test.xml
What am I doing wrong?
Thanks!