XSLT for Authors

Post on 23-Jan-2018

90 views 0 download

Transcript of XSLT for Authors

XSLT for Authors

Jang F.M. Graat The Content Era

Who’s Talking ?

http://in18.honestly.de

The Bad Old Days

Private Alphabets

Hidden Revolution

New Alphabet

<?xml version=“1.0”?>

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>

Your Own Order

Use What You Need

XSLT + XPath

XML + XSLT = Magic

Automating Change

Transformation

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

XPath

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

XSL : Set of Tools

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">

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"/>

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>

Start the Process

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

</xsl:template>

Copying Input

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

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

</xsl:template>

Dropping Input

<xsl:template match=“prolog" />

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

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

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

Creating Elements

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

<xsl:apply-templates /> <caption>

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

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

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>

Selecting Targets

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

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

</xsl:template>

http://in18.honestly.de

4everJangwww.thecontentera.com