|
You can use style sheets to vary how a specific tag on an HTML page displays underlying text. XTP can be used in much the same way; you define tags that can implement many different types of style. For example, if you commonly use the combination <CENTER><B> for headings in a page, you can create a new tag called <centerbig>. The XSL file code might look like this:
<xsl:template match='*|@*'> <xsl:copy> <xsl:apply-templates select='node()|@*'/> </xsl:copy> </xsl:template> <xsl:template match="centerbig"> <CENTER><H1> <xsl:apply-templates select="node()|@*"/> </H1></CENTER> </xsl:template>
In this XSL snippet, a match on the element centerbig causes the tags <CENTER><H1> to be output. Next, a match is made against node()|@*, which pulls any element or attribute. This has the effect of copying the next element to the output. Finally, the closing tags, </H1></CENTER>, are output.
|