Mega Code Archive

 
Categories / XML / XSLT StyleSheet
 

Get sibling with

File: Data.xml <vintage>   <year>1998</year>   <wine grape="B">     <winery>A</winery>   </wine> </vintage> File: Transform.xslt <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"   version="1.0">   <xsl:output method="xml" omit-xml-declaration="yes" indent="no" />      <xsl:template match="wine">     <wine varietal="{@grape}" brand="{winery}" year="{../year}" />   </xsl:template>   <xsl:template match="year" />    </xsl:stylesheet> Output:      <wine varietal="B" brand="A" year="1998"/>