I am converting a xml using xslt.
Original XML is
<Content>
<book>
<customData>
<CustomDataElement>
<title>book-name</title>
<value>Java</value>
</CustomDataElement>
<CustomDataElement>
<title>genre</title>
<value>Programming</value>
</CustomDataElement>
</customData>
</book>
<authors>
<author>
<name>authorOne</name>
<country>US</country>
</author>
</authors>
<book>
<customData>
<CustomDataElement>
<title>book-name</title>
<value>Stranger</value>
</CustomDataElement>
<CustomDataElement>
<title>genre</title>
<value>Fiction</value>
</CustomDataElement>
</customData>
</book>
<authors>
<author>
<name>authorthree</name>
<country>UK</country>
</author>
</authors>
</Content>
and my xslt is as follows
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:template match="/">
<xsl:for-each select="Content/book">
<media>
<book>
<xsl:apply-templates select="customData/CustomDataElement[title = 'book-name']" />
</book>
<genre>
<xsl:apply-templates select="customData/CustomDataElement[title = 'genre']" />
</genre>
<author>
<xsl:value-of select="../authors/author/name" />
</author>
</media>
</xsl:for-each>
</xsl:template>
<xsl:template match="CustomDataElement">
<xsl:value-of select="value" />
</xsl:template>
</xsl:stylesheet>
This gives me output as
<?xml version="1.0"?>
<media>
<book>Java</book>
<genre>Programming</genre>
<author>authorOne</author>
</media>
<media>
<book>Stranger</book>
<genre>Fiction</genre>
<author>authorOne</author>
</media>
I want the authors name from the tag 'authors\author' which follows the book tag.
what i am missing here ? pls help