473,785 Members | 2,372 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting Xerces to accept copy-of parameters

I have a problem using Xerces with a template for
a generic page-header getting a sub-tree as argument.
The same stylesheet is working flawlessly in IE and
Mozilla, though it would be nice to have a result-file
to work with too.

Here is an example (xerces only get a collapsed string through),
any suggestions or current bug-reports are welcome.

/ Patrik

My "paramtest. xml" :

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="sendparam .xsl"?>
<rootnode>
<treenode>
<organization>T he Apache Software Foundation</organization>
<street>1901 Munsey Drive</street>
<address>Fore st Hill, MD 21050-2747</address>
<country>U.S. A</country>
</treenode>
<othernode>
othernode
</othernode>
</rootnode>

The stylesheet "sendparam. xsl" sending a node as parameter :

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
encoding="ISO-8859-1" />

<xsl:include href="getparam. xsl"/>

<xsl:template match="rootnode ">

<xsl:variable name="treecopy" >
<xsl:copy-of select="treenod e"/>
</xsl:variable>

<xsl:call-template name="testtempl ate">
<xsl:with-param name="paramtree " select="$treeco py"/>
</xsl:call-template>

</xsl:template>
</xsl:stylesheet>

A generic stylesheet "getparam.x sl" using the parameter :

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes"
encoding="ISO-8859-1" />

<xsl:template name="testtempl ate">
<xsl:param name="paramtree ">no recipent</xsl:param>
<xsl:for-each select="$paramt ree/treenode/*">
<b>
<xsl:value-of select="."/>
</b>
<br/>
</xsl:for-each>
</xsl:template>

</xsl:stylesheet>
Jul 20 '05 #1
2 2170
pa************* @mail.com (Patrik Carlsson) wrote in message news:<60******* *************** ***@posting.goo gle.com>...
I have a problem using Xerces with a template for
a generic page-header getting a sub-tree as argument.
The same stylesheet is working flawlessly in IE and
Mozilla, though it would be nice to have a result-file
to work with too.

Here is an example (xerces only get a collapsed string through),
any suggestions or current bug-reports are welcome.

/ Patrik

You do mean you're using Xalan, right? Xerces is an XML parser, not
an XSLT processor.

....
The stylesheet "sendparam. xsl" sending a node as parameter :

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
encoding="ISO-8859-1" />

<xsl:include href="getparam. xsl"/>

<xsl:template match="rootnode ">

<xsl:variable name="treecopy" >
<xsl:copy-of select="treenod e"/>
</xsl:variable>

....

This variable is a result tree fragment, which has limitations in XSLT
1.0.
<xsl:call-template name="testtempl ate">
<xsl:with-param name="paramtree " select="$treeco py"/>
</xsl:call-template>

</xsl:template>
</xsl:stylesheet>

A generic stylesheet "getparam.x sl" using the parameter :

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes"
encoding="ISO-8859-1" />

<xsl:template name="testtempl ate">
<xsl:param name="paramtree ">no recipent</xsl:param>
<xsl:for-each select="$paramt ree/treenode/*">
<b>
<xsl:value-of select="."/>
</b>
<br/>
</xsl:for-each>
</xsl:template>

</xsl:stylesheet>


You are trying to use a result tree fragment as a node-set, which is
not allowed in XSLT 1.0. MSXSL 3.0 allows this, but 4.0 does not. I
don't know why Mozilla allows this, but that's a bug. Xalan is
correctly rejecting your stylesheet.

One way around this is to use a processor-specific extension to
convert a result tree fragment. Another choice is to use the EXSLT
node-set extension, which is more portable.

Dave
Jul 20 '05 #2
db******@channe l1.com (Dave Bertoni) wrote in message news:<79******* *************** ****@posting.go ogle.com>...
pa************* @mail.com (Patrik Carlsson) wrote in message news:<60******* *************** ***@posting.goo gle.com>...
I have a problem using Xerces with a template for
a generic page-header getting a sub-tree as argument.
The same stylesheet is working flawlessly in IE and
Mozilla, though it would be nice to have a result-file
to work with too.

Here is an example (xerces only get a collapsed string through),
any suggestions or current bug-reports are welcome.
See the old post...
/ Patrik


You are trying to use a result tree fragment as a node-set, which is
not allowed in XSLT 1.0. MSXSL 3.0 allows this, but 4.0 does not. I
don't know why Mozilla allows this, but that's a bug. Xalan is
correctly rejecting your stylesheet.

One way around this is to use a processor-specific extension to
convert a result tree fragment. Another choice is to use the EXSLT
node-set extension, which is more portable.

Dave


Thank's for the help,
Knowing the difference between node-sets and tree-fragments helped a lot.
Since my application was simple just sending the node without using
a variable solved my problem:

<xsl:with-param name="paramtree " select="/rootnode/treenode"/>

Then the parameter can be traversed as I wished

<xsl:for-each select="$paramt ree/*">
<b><xsl:value-of select="."/></b><br/>
</xsl:for-each>

Cheers
Patrik
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1638
by: Badebecq | last post by:
I am new to Java and XML and I am trying to solve a problem that has bothered for few days. I have download the parser Xerser-1.4.4 and j2sdk1.4.1_04 I install the JDK first and test it, it works. Then I install the parser, using this command right under the C drive. jar xf xerces-j-bin.1.4.4.zip This creates a directory named xerces-1_4_4. I set the CLASSPATH to
4
5611
by: joes | last post by:
Hello there I tried for several days to get a simple validation with xml schema & xerces working. Goal for me is tuse JAXP and not specific Xerces classes. I don't get the point what I am doing wrong. Could somebody help me? I didn't find any full example working on the net. Thank you for any hints! If I run the examples below, the parsers parses the file well, no vlaidation is occuring although the schema and xml file does not
0
1438
by: Francesco Moi | last post by:
Hi. I'm trying to parse a HTTP file http://www.foo.com/foo.xml by using Xerces-Perl: ------------------------------------------ use XML::Xerces; my $file = XML::Xerces::LocalFileInputSource->new("http://www.foo.com/foo.xml");
1
3824
by: Hans Bijvoet | last post by:
Hello, I'm trying to parse a HTML document with the SAX parser from Xerces. The parser throws a fatal error when attribute values in the document are not surrounded by quotes? How can I prevent this parser's behaviour? Greetings, Hans
4
4442
by: MBR | last post by:
Help! Does anybody know a simple example how to use xerces (http://xml.apache.org) with C++ to parse a simple xml file, go from node to node and read the data in the nodes? Thanks, Matthias
4
3059
by: cgparis | last post by:
Dear forum members, I am trying to compile C++ code under MS Visual Studio .NET 2003, which references the latest Xerces C++ release library (2.6.0). This Xerces release was made available recently by the Apache organization. I've defined a system variable on windows as follows: XERCESCROOT: <...>\xerces-c_2_6_0-windows_nt-msvc_60
2
3673
by: VanOrton | last post by:
Hi all, When XercesDOMParser parses an XML document with a Schema instance, by default it adds all missing default and fixed attributes. I have the impression though that it misses the namespace prefices... I'm using Xerces 2.5.0. Here's a document parsed by Xerces:
4
6412
by: Sanjay Kumar | last post by:
Folks ! I am working with VC++ after a long time and having problem linking latest xerces 2.7 in VC++ 2005 Express Edition. I have done following: 1. downloaded and unpacked the the library: http://www.apache.org/dist/xml/xerces-c/binaries/xerces-c_2_7_0-windows_2000-msvc_60.zip
0
1437
by: Willis | last post by:
I'm starting a MFC project that is best described as a XML editor. After searching around for parsers and stuff it sounds like Xerces/SAX is the rout I need to take. So I downloaded xerces-c-src_2_7_0 and xerces-c_2_7_0-windows_2000-msvc_60. I've been trying to apply Xerces into my C++ project for a while without any clue what I'm doing. And so far I haven't had any luck googling for tutorials on getting started. I'm running Visual...
5
3057
by: =?ISO-8859-1?Q?Ernesto_Basc=F3n_Pantoja?= | last post by:
Hi everybody: I do not know if this is the correct list to a very specific implementation problem, but if you can help me, it would be great! :) I have one application that builds a Xml that contains some strange characters: std::string str = "Code = "; str += '♦'; //strange character ASCII 4
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10315
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10085
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9947
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5379
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4045
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.