xsl-list
[Top] [All Lists]

Re: Attempting *not* to copy certain nodes

2004-01-14 14:17:29
Date: Wed, 14 Jan 2004 13:12:47 -0500
From: "G. Ken Holman" <gkholman(_at_)CraneSoftwrights(_dot_)com>
Subject: Re: [xsl] Attempting *not* to copy certain nodes

At 2004-01-14 12:26 -0500, 3rett 3onfield wrote:

The code that suppresses the soap namespace is from G. Ken Holman's post:
http://www.biglist.com/lists/xsl-list/archives/200207/msg01649.html

Unfortunately, this seems to generate errors in Saxon (Treebeard's processor), IE, and Firebird. Ken uses semicolons when declaring namespaces,


BigList must have added the semicolons, Brett ... reviewing my archives I see no semicolons in the original message. You'll note from the posted transcript that Saxon runs with the file that is exposed, and it would not have run if there were semicolons as that isn't well-formed.


other places they don't ( http://www.xml.com/pub/a/2001/04/04/trxml/ ), but both (or, of course, something else I'm doing wrong) generate errors such that I get no output.


You don't mention what errors you get ... I'm assuming you cleaned up the well-formedness of the file.

........................ Ken

Thank you for responding. According to RUWF ( http://www.xml.com/pub/a/tools/ruwf/check.html) the following is well formed:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/";
                exclude-result-prefixes="soap-env"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
                xmlns:xsd="http://www.w3.org/2001/XMLSchema";
                version="1.0">
<xsl:output method="text" indent="yes" encoding="UTF-8"/>

<xsl:template match="/">
  <xsl:apply-templates select="soap:Envelope/soap:Body/node()"/>
</xsl:template>

<xsl:template match="*"> <!--synthesize element with the input name-->
  <xsl:element name="{name(.)}" namespace="{namespace-uri(.)}">
    <xsl:copy-of select="@*"/>
    <xsl:apply-templates/>
  </xsl:element>
</xsl:template>

    <xsl:template match="/">
        <xsl:for-each select="MapSecuritiesResult/Security">
                <xsl:if test="Outcome='Success'">
                <xsl:copy-of select="Name"/>, <!--
                --><xsl:copy-of select="Symbol"/>, <!--
                --><xsl:copy-of select="CIK"/>, <!--
                --><xsl:copy-of select="Cusip"/>, <!--
                --><xsl:copy-of select="Market"/>
                <xsl:text>&#13;</xsl:text>
                </xsl:if>
        </xsl:for-each>
        </xsl:template>
</xsl:stylesheet>

These are the errors I'm getting:

IE 6:
Reference to undeclared namespace prefix: 'soap'.

Firebird 0.7:
Error loading stylesheet: Parsing an XPath expression failed.

Xerxes (via Treebeard -- it offers Saxon parsing as an option, but I can't seem to get it to work): Window::transform: javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: Prefix must resolve to a namespace: soap javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: Prefix must resolve to a namespace: soap at org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:946)
        at com.robrohan.treebeard.TreeTransform.transform(Unknown Source)
        at com.robrohan.fangorn.Ent.transform(Unknown Source)
        at com.robrohan.fangorn.Ent.access$1200(Unknown Source)
        at com.robrohan.fangorn.Ent$3.run(Unknown Source)
Caused by: javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: Prefix must resolve to a namespace: soap at org.apache.xalan.processor.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:942)
        ... 4 more

Once again, thank you for helping me.

Brett



XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list