Subject: [xsl] how to applied "xpath-default-namespace" within call templates From: "Joga Singh Rawat" <jrawat@xxxxxxxxxxxxxx> Date: Sun, 17 Jun 2012 14:59:27 +0530 |
Hi All, I am not able to get below "required output". I am getting below error by Oxygen. It is necessary to include "xpath-default-namespace="http://www.elsevier.com/xml/bk/dtd" as one of the attribute of <xsl:stylesheet>. Frror: E [Saxon-PE 9.3.0.5] Required item type of value of variable $attributes is {http://www.elsevier.com/xml/bk/dtd}attribute; supplied value has item type element(attribute, {http://www.w3.org/2001/XMLSchema}untyped) Input <chapter docsubtype="chp" id="chapter1" version="5.2" xml:lang="en" xmlns="http://www.elsevier.com/xml/bk/dtd" xmlns:ce="http://www.elsevier.com/xml/common/dtd" xmlns:sb="http://www.elsevier.com/xml/common/struct-bib/dtd"> <ce:table id="para1" frame="topbot" rowsep="0" colsep="0">....</ce:table> </chapter> Stylesheet <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ce="http://www.elsevier.com/xml/common/dtd" xmlns:sb="http://www.elsevier.com/xml/common/struct-bib/dtd" xpath-default-namespace="http://www.elsevier.com/xml/bk/dtd" exclude-result-prefixes="xs xsd ce sb " version="2.0"> <xsl:template match="ce:table"> <p> <xsl:call-template name="collate-attributes" > <xsl:with-param name="attributes" as="element(attribute)+"> <attribute name="frame" display="para Frame" other-values="top, all, none, topbot, sides, bottom"/> </xsl:with-param> </xsl:call-template> <xsl:apply-templates/> </p> </xsl:template> <xsl:template name="collate-attributes" > <xsl:param name="attributes" required="yes" as="element(attribute)*"/> <xsl:variable name="here" select="."/> <xsl:attribute name="showattrib"> <xsl:for-each select="$attributes"> <xsl:variable name="name" select="@name"/> <xsl:variable name="display" select="@display"/> <xsl:variable name="there" select="$here/@*[name() eq $name]"/> <xsl:if test="not(position() eq 1)">|</xsl:if> <xsl:value-of select="$name"/> <xsl:text>@</xsl:text> <xsl:value-of select="$display"/> <xsl:text>:</xsl:text> <xsl:value-of select="$there"/> <xsl:for-each select="tokenize(@other-values,';')[not(. eq $there)]"> <xsl:value-of select="concat(';',.)"/> </xsl:for-each> </xsl:for-each> </xsl:attribute> </xsl:template> </xsl:stylesheet> Required Output: <p showattrib="frame@para Frame:topbot;top, all, none, topbot, sides, bottom">....</p> Thanks ...JSR
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] shortest way to write thi, henry human | Thread | Re: [xsl] how to applied "xpath-def, Michael Kay |
Re: [xsl] [ANN] Saxon-CE 1.0 (XSLT , Michael Kay | Date | [xsl] how to applied "xpath-default, Joga Singh Rawat |
Month |