Commit 95fc377e authored by Wendell Piez's avatar Wendell Piez
Browse files

Adding inline markup to supplement paragraph-level styling, addressing issue #3

parent b4769a21
......@@ -56,6 +56,39 @@
<xsl:comment> implicit </xsl:comment>
<!-- target element types are -after- mapping of inlines as elsewhere in this XSLT
i -> em, b -> strong etc. -->
<xsl:variable as="element()+" name="mapped-styles">
<em>font-style: italic</em>
<strong>font-weight: bold</strong>
<i>text-decoration: underline</i>
<xsl:template match="p">
<xsl:variable name="signals" select="xsw:style-propertyValues(.)[.=$mapped-styles]"/>
<xsl:variable name="me" select="."/>
<xsl:variable name="mine">
<xsl:copy-of select="@*"/>
<xsl:iterate select="$mapped-styles[. = $signals]">
<xsl:param name="contents" select="$mine"/>
<xsl:sequence select="$contents"/>
<xsl:with-param name="contents">
<xsl:element name="{name(.)}" namespace="">
<xsl:sequence select="$contents"/>
<!-- Any 'i' element becomes an 'em' element; its attributes are copied. -->
<!-- (Unwanted attributes can be removed in a subsquent step.) -->
......@@ -108,4 +141,14 @@
<xsl:function name="xsw:style-propertyValues" as="xs:string*">
<!-- Returns 'font-family: Helvetica','font-size: 10pt' whatever
properties are defined on @style -->
<xsl:param name="e" as="element()"/>
<xsl:sequence select="tokenize($e/@style/normalize-space(.),'\s*;\s*')"/>
<xsl:key name="elements-by-propertyValue" match="*[matches(@style,'\S')]" use="xsw:style-propertyValues(.)"/>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment