xsl:namespace-alias

only for RuBoard

xsl: namespace-alias

xsl:namespace-alias aliases a prefix name in the stylesheet. This is useful for creating stylesheets as the result of a transformation.

Attributes

Attribute Name

Enforced

Description

Values

terminate

Required

Specifies if the XSLT processor should halt processing

Either yes or no

Example

Suppose that you want to generate a stylesheet to transform data from HTML to PDF format. Consider the following XML document, elements.xml :

 <?xml version="1.0" encoding="utf-8" ?>  <elements>       <block>p</block>       <block>h1</block>       <block>h2</block>       <block>h3</block>       <block>h4</block>  </elements> 

You can use this set of elements to generate a stylesheet by aliasing the axsl prefix so that it appears in the result tree with the xsl prefix:

 <xsl:stylesheet    version="1.0"    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"    xmlns:fo="http://www.w3.org/1999/XSL/Format"    xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias">  <xsl:namespace-alias stylesheet-prefix="axsl" result-prefix="xsl"/>  <xsl:template match="/">    <axsl:stylesheet>      <xsl:apply-templates/>    </axsl:stylesheet>  </xsl:template>  <xsl:template match="block">    <axsl:template match="{.}">       <fo:block><axsl:apply-templates/></fo:block>    </axsl:template>  </xsl:template>  </xsl:stylesheet> 

The result of this transformation is another stylesheet. Notice that elements prefixed with axsl in the source stylesheet are output in the result with the xsl prefix.

 <?xml version="1.0" encoding="UTF-16"?>  <xsl:stylesheet xmlns:fo="http://www.w3.org/1999/XSL/Format"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">       <xsl:template match="p"><fo:block><xsl:apply-templates /></fo:block></xsl:template>       <xsl:template match="h1"><fo:block><xsl:apply-templates /></fo:block></xsl:template>       <xsl:template match="h2"><fo:block><xsl:apply-templates /></fo:block></xsl:template>       <xsl:template match="h3"><fo:block><xsl:apply-templates /></fo:block></xsl:template>       <xsl:template match="h4"><fo:block><xsl:apply-templates /></fo:block></xsl:template>  </xsl:stylesheet> 

Parent Elements

 xsl:stylesheet 

Child Elements

None.

only for RuBoard


XML and ASP. NET
XML and ASP.NET
ISBN: B000H2MXOM
EAN: N/A
Year: 2005
Pages: 184

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net