[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

how to applied "xpath-default-namespace" within call

Subject: how to applied "xpath-default-namespace" within call templates
From: "Joga Singh Rawat" <jrawat@xxxxxxxxxxxxxx>
Date: Sun, 17 Jun 2012 14:59:27 +0530
 how to applied "xpath-default-namespace" within call
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.