<!--
  Naver2RSS 뉴스 목록 XSLT
  누가: 신재호 <netj@sparcs.kaist.ac.kr>
  언제: 2004-01-03
  $Id$
-->
<xsl:stylesheet version="1.0"
    xmlns:xhtml="http://www.w3.org/1999/xhtml"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:import href="naver2rss.xsl"/>
    <!-- 기사들 뽑아와서 뿌려주기. tidy가 정리해준 XHTML에는,
     a를 포함하는 각 td마다 기사가 들어있음 -->
    <xsl:template match="xhtml:td">
	<!-- 첫 번째 a의 내용이 기사 제목이며, @href 속에 주소가 들어있음 -->
	<xsl:variable name="link" select="./xhtml:a[1]"/>
	<!-- $link가 없거나 javascript:로 시작하면 건너뜀 -->
	<xsl:if test="$link and not(starts-with($link/@href, 'javascript:'))">
	    <item>
		<title>
		    <!-- a에 보이는 내용이 곧 제목 -->
		    <xsl:value-of select="$link"/>
		</title>
		<link>
		    <xsl:call-template name="polish-url">
			<xsl:with-param name="url" select="$link/@href"/>
		    </xsl:call-template>
		</link>
		<xsl:call-template name="who-when">
		    <xsl:with-param name="data" select="xhtml:span[1]"/>
		</xsl:call-template>
		<description>
		    <xsl:if test="./xhtml:table//xhtml:img/@src">
			<!-- 기사 그림도 포함시킨다. -->
			&lt;img align="left" src="<xsl:call-template name="polish-url">
			    <xsl:with-param name="url" select="./xhtml:table//xhtml:img/@src"/>
			</xsl:call-template>"&gt;
		    </xsl:if>
		    <!-- 기사 요약 -->
		    <xsl:copy-of select="./text()"/>
		</description>
	    </item>
	</xsl:if>
    </xsl:template>
</xsl:stylesheet>

