SourceCode/PROMS/fmtxml/TranslateDoc.XSL
2008-08-26 14:21:56 +00:00

180 lines
6.4 KiB
Plaintext

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="DocStyles">
<DocStyles>
<xsl:apply-templates/>
</DocStyles>
</xsl:template>
<xsl:template match="DcStyles">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="DocStyle">
<DocStyle>
<xsl:apply-templates select="Name"/>
<xsl:apply-templates select="Index"/>
<xsl:apply-templates select="numberingsequence"/>
<xsl:apply-templates select="IsStepSection"/>
<xsl:apply-templates select="oldtonew"/>
<xsl:apply-templates select="pagestyle"/>
<xsl:apply-templates select="dstyle|DocStructStyle|PTopRow|ContStyle|EndStyle|FinalMsg"/>
</DocStyle>
</xsl:template>
<xsl:template match="numberingsequence">
<xsl:attribute name="NumberingSequence"><xsl:value-of select="."/></xsl:attribute>
</xsl:template>
<xsl:template match="IsStepSection">
<xsl:attribute name="IsStepSection"><xsl:value-of select="."/>
</xsl:attribute>
</xsl:template>
<xsl:template match="oldtonew">
<xsl:attribute name="OldToNew"><xsl:value-of select="."/></xsl:attribute>
</xsl:template>
<xsl:template match="dstyle">
<xsl:if test="string-length(./FontFamily)+string-length(./FontSize)+string-length(./FontStyle)>0">
<Font>
<xsl:if test="FontFamily">
<xsl:attribute name="Family">
<xsl:value-of select="FontFamily"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="FontSize">
<xsl:attribute name="Size">
<xsl:value-of select="FontSize"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="FontStyle">
<xsl:attribute name="Style">
<xsl:value-of select="FontStyle"/>
</xsl:attribute>
</xsl:if>
</Font>
</xsl:if>
</xsl:template>
<xsl:template match="PTopRow">
<Layout>
<xsl:attribute name="TopRow"><xsl:value-of select="."/></xsl:attribute>
<xsl:attribute name="FooterLength"><xsl:value-of select="..//FooterLen"/></xsl:attribute>
<xsl:attribute name="PageLength"><xsl:value-of select="..//PageLength"/></xsl:attribute>
<xsl:attribute name="PageWidth"><xsl:value-of select="..//PageWidth"/></xsl:attribute>
<xsl:apply-templates/>
</Layout>
</xsl:template>
<xsl:template match="ContStyle">
<xsl:if test="string-length(..//ContTop)+string-length(..//ContBottom)>0">
<Continue>
<xsl:if test="string-length(./FontFamily)+string-length(./FontSize)+string-length(./FontStyle)>0">
<Font>
<xsl:if test="FontFamily">
<xsl:attribute name="Family">
<xsl:value-of select="FontFamily"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="FontSize">
<xsl:attribute name="Size">
<xsl:value-of select="FontSize"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="FontStyle">
<xsl:attribute name="Style">
<xsl:value-of select="FontStyle"/>
</xsl:attribute>
</xsl:if>
</Font>
</xsl:if>
<Top>
<xsl:if test="..//ContTop != 'empty'">
<xsl:attribute name="Message">
<xsl:value-of select="../ContTop"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="..//ContTopHLS != 'empty'">
<xsl:attribute name="HLS">
<xsl:value-of select="..//ContTopHLS"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="..//CTMargin != 'empty'">
<xsl:attribute name="Margin">
<xsl:value-of select="..//CTMargin"/>
</xsl:attribute>
</xsl:if>
</Top>
<Bottom>
<xsl:if test="..//ContBottom != 'empty'">
<xsl:attribute name="Message">
<xsl:value-of select="../ContBottom"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="..//CBMargin != 'empty'">
<xsl:attribute name="Margin">
<xsl:value-of select="..//CBMargin"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="..//CBLoc != 'empty'">
<xsl:attribute name="Location">
<xsl:value-of select="..//CBLoc"/>
</xsl:attribute>
</xsl:if>
</Bottom>
</Continue>
</xsl:if>
</xsl:template>
<xsl:template match="EndStyle">
<xsl:if test="../EndString != 'empty'">
<End>
<xsl:if test="../EndFlag != 'empty'">
<xsl:attribute name="Flag">
<xsl:value-of select="../EndFlag"/>
</xsl:attribute>
</xsl:if>
<xsl:attribute name="Message">
<xsl:value-of select="../EndString"/>
</xsl:attribute>
<xsl:if test="string-length(./FontFamily)+string-length(./FontSize)+string-length(./FontStyle)>0">
<Font>
<xsl:if test="FontFamily">
<xsl:attribute name="Family">
<xsl:value-of select="FontFamily"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="FontSize">
<xsl:attribute name="Size">
<xsl:value-of select="FontSize"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="FontStyle">
<xsl:attribute name="Style">
<xsl:value-of select="FontStyle"/>
</xsl:attribute>
</xsl:if>
</Font>
</xsl:if>
</End>
</xsl:if>
</xsl:template>
<xsl:template match="FinalMsg">
<Final>
<xsl:attribute name="Message"><xsl:value-of select="."/></xsl:attribute>
</Final>
</xsl:template>
<xsl:template match="DocStructStyle">
<StructureStyle>
<xsl:attribute name="Where"><xsl:value-of select="DocStyleUse"/></xsl:attribute>
<xsl:if test="DocStyle != 'None'"><xsl:attribute name="Style"><xsl:value-of select="DocStyle"/></xsl:attribute></xsl:if>
</StructureStyle>
</xsl:template>
<xsl:template match="Name">
<xsl:attribute name="Name"><xsl:value-of select="."/></xsl:attribute>
</xsl:template>
<xsl:template match="Index">
<xsl:attribute name="Index"><xsl:value-of select="."/></xsl:attribute>
</xsl:template>
<xsl:template match="pagestyle">
<xsl:attribute name="PageStyle"><xsl:value-of select="."/></xsl:attribute>
</xsl:template>
<xsl:template match="text()"/>
</xsl:stylesheet>