XSLT for Authors

29
XSLT for Authors Jang F.M. Graat The Content Era

Transcript of XSLT for Authors

Page 1: XSLT for Authors

XSLT for Authors

Jang F.M. Graat The Content Era

Page 2: XSLT for Authors

Who’s Talking ?

Page 3: XSLT for Authors

http://in18.honestly.de

Page 4: XSLT for Authors

The Bad Old Days

Page 5: XSLT for Authors

Private Alphabets

Page 6: XSLT for Authors

Hidden Revolution

Page 7: XSLT for Authors

New Alphabet

<?xml version=“1.0”?>

Page 8: XSLT for Authors

Content + Metadata

<?xml version="1.0" encoding="UTF-8"?><dita>

<topic id="id1593DM00FON"><title>Alice down the rabbit hole</title><body>

<p id="id159AG50900P" audience=“tom">Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do: once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, 'and what is the use of a book,' Alice thought, ‘without pictures or conversations?’</p>

Page 9: XSLT for Authors

Your Own Order

Page 10: XSLT for Authors

Use What You Need

Page 11: XSLT for Authors

XSLT + XPath

Page 12: XSLT for Authors

XML + XSLT = Magic

Page 13: XSLT for Authors

Automating Change

Page 14: XSLT for Authors

Transformation

Page 15: XSLT for Authors

Power of xsltt r a n s f o r m X M L i n t o

a n y t h i n g e l s e

Page 16: XSLT for Authors

XPath

Page 17: XSLT for Authors

//title[contains(.,’intro’)]

Page 18: XSLT for Authors

XSL : Set of Tools

Page 19: XSLT for Authors

Choose the Version

<xsl:stylesheet xmlns:xsl=“http://www.w3.org/1999/XSL Transform"xmlns:xs="http://www.w3.org/2001/XMLSchema"

exclude-result-prefixes="xs"version="2.0">

Page 20: XSLT for Authors

Define the Format

<xsl:output method="xml" encoding="UTF-8" doctype-public="-//OASIS//DTD DITA Topic//EN" doctype-system="topic.dtd"/>

<xsl:output method="html" encoding="UTF-8"/>

<xsl:output method="text" encoding="UTF-16"/>

Page 21: XSLT for Authors

Template = Recipe

<xsl:template match="figure"><xsl:copy>

<xsl:attribute name="id"><xsl:value-of select="position()"/>

</xsl:attribute><xsl:apply-templates select="image"/> <caption>

<xsl:value-of select="title"/> </caption>

</xsl:copy></xsl:template>

Page 22: XSLT for Authors

Start the Process

<xsl:template match="/"><xsl:apply-templates/>

</xsl:template>

Page 23: XSLT for Authors

Copying Input

<xsl:template match="@*|node()"><xsl:copy>

<xsl:apply-templates select="@*,node()"/> </xsl:copy>

</xsl:template>

Page 24: XSLT for Authors

Dropping Input

<xsl:template match=“prolog" />

<xsl:template match=“*[@status=‘deleted’]” />

<xsl:template match=“topic/body/p[1]” />

<xsl:template match=“p[parent::fig]” />

Page 25: XSLT for Authors

Creating Elements

<xsl:template match="figure"><xsl:copy>

<xsl:apply-templates /> <caption>

<xsl:value-of select="title"/> </caption>

</xsl:copy></xsl:template>

Page 26: XSLT for Authors

Creating Attributes

<xsl:template match="figure"><xsl:copy>

<xsl:attribute name="id"><xsl:value-of select="position()"/>

</xsl:attribute><xsl:apply-templates />

</xsl:copy></xsl:template>

Page 27: XSLT for Authors

Selecting Targets

<xsl:template match="figure"><xsl:copy>

<xsl:apply-templates select="image"/> </xsl:copy>

</xsl:template>

Page 28: XSLT for Authors

http://in18.honestly.de

Page 29: XSLT for Authors

4everJangwww.thecontentera.com