X hits on this document

416 views

0 shares

1 downloads

0 comments

46 / 142

Transforming XML with XSLT

<title><xsl:value-of select="addressee

<!-- close the head element --> </head>

<!-- open the body tag and give it some <body style="margin: 5%">

<!-- find various templates in the XSL associated values -->

<xsl:apply-templates <xsl:apply-templates <xsl:apply-templates <xsl:apply-templates <xsl:apply-templates

select="date"/> select="addressee select="greeting" select="paragraph select="closing"/

<!-- close the body tag --> </body>

<!-- close the XHTML file --> </html>

</xsl:template>

<!-- date --> <xsl:template match="date">

<!-- output a paragraph tag and the cont node, date --> <p><xsl:apply-templates/></p>

</xsl:template>

<!-- addressee --> <xsl:template match="addressee">

<!-- open a paragraph --> <p>

<!-- output the content of letter.xml's

and address_two elements, as well <xsl:value-of select="name"/><br /> <xsl:value-of select="address_one"/><br <xsl:value-of select="address_two"/>

<!-- close the paragraph --> </p>

</xsl:template>

<!-- each of the following templates oper date template -->

<!-- greeting --> <xsl:template match="greeting">

<p> <xsl:apply-templates/> </p> </xsl:template>

<!-- paragraph --> <xsl:template match="paragraph">

<p style="text-indent: 1em"> <xsl:apply-templates/>

38

/name"/></title>

style -->

T file with their

"/> />

| list" /> >

ent of the current

name, address_one, a couple br tags -->

/>

ate exactly like the

Document info
Document views416
Page views422
Page last viewedTue Dec 06 15:45:22 UTC 2016
Pages142
Paragraphs3126
Words34660

Comments