<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="UTF-8" indent="yes"/>
<xsl:template match="/episode">
<!-- lang 속성이 Arabic인 경우 rtl(우->좌), 아닐 경우 ltr(좌->우) 설정 -->
<xsl:variable name="direction">
<xsl:choose>
<xsl:when test="@lang = 'Arabic'">rtl</xsl:when>
<xsl:otherwise>ltr</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- HTML lang 속성 매핑 (Arabic -> ar, 기타 -> ko/en 등) -->
<xsl:variable name="htmlLang">
<xsl:choose>
<xsl:when test="@lang = 'Arabic'">ar</xsl:when>
<xsl:otherwise>ko</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<html lang="{$htmlLang}" dir="{$direction}">
<head>
<meta charset="UTF-8"/>
<title><xsl:value-of select="title"/></title>
<style>
body {
font-family: -apple-system, "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
background-color: #f8fafc;
color: #1e293b;
padding: 40px 20px;
display: flex;
justify-content: center;
}
.card {
background: #ffffff;
max-width: 720px;
width: 100%;
border-radius: 12px;
border: 1px solid #e2e8f0;
padding: 30px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}
h1 {
font-size: 1.6rem;
color: #0f172a;
border-bottom: 2px solid #f1f5f9;
padding-bottom: 12px;
margin-top: 0;
}
p.narrative {
font-size: 1.05rem;
line-height: 1.9;
color: #334155;
white-space: pre-line; /* 본문 줄바꿈 유지 */
}
/* Arabic일 경우 추가 가독성 스타일 */
[dir="rtl"] {
text-align: right;
}
</style>
</head>
<body>
<div class="card">
<h1><xsl:value-of select="title"/></h1>
<p class="narrative"><xsl:value-of select="narrative"/></p>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>