473,804 Members | 2,962 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to inherit namespace into xinclude included elements

Given the "includer" xml file:

<?xml version="1.0"?>
<test-includer
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
xmlns:testns="h ttp://www.w3.org/TR/REC-xml-names"
xmlns:xi="http://www.w3.org/2001/XInclude"
<xi:include
href="test-included.xml"
parse="xml"
/>
</test-includer>

and the "included" xml file:

<testns:test-element>1</testns:test-element>

and the xsl file:

<?xml version="1.0"?>
<xsl:styleshe et
version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
xmlns:testns="h ttp://www.w3.org/TR/REC-xml-names"

<xsl:output method="text"/>

<xsl:template match="/">
<xsl:value-of select="testns: test-element"/>
</xsl:template>

how do I avoid the duplication of the testns declaration
in the "includer" xml and the xsl file, and how do I
cause the testns namespace to be inherited by the
included elements (e.g. <testns:test-element> ). IOW,
I want to avoid the error message from xsltproc:

xsltproc --xinclude -o test-includer.html test-includer.xsl
test-includer.xml
test-included.xml:1: namespace error : Namespace prefix testns on
test-element is not defined
<testns:test-element>1</testns:test-element>
^

TIA.

Sep 17 '05 #1
1 1491
In article <11************ **********@g43g 2000cwa.googleg roups.com>,
Larry <cp********@c ox-internet.com> wrote:
and the "included" xml file:

<testns:test-element>1</testns:test-element>
That won't work. XInclude isn't a text replacement mechanism; it
works on parsed XML documents (infosets). If you want textual
inclusion you could use an external entity:

<?xml version="1.0"?>
<!DOCTYPE test-includer [
<!ENTITY t SYSTEM "test-included.xml">
]>
<test-includer
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
xmlns:testns="h ttp://www.w3.org/TR/REC-xml-names"
xmlns:xi="http://www.w3.org/2001/XInclude"

&t;
</test-includer>

-- Richard
Sep 20 '05 #2

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

Similar topics

1
2725
by: John L. Clark | last post by:
I am curious as to the rationale, and effect, of having default namespaces not applying (directly) to attributes (see http://www.w3.org/TR/REC-xml-names/#defaulting). Given an attribute without a namespace prefix, what is its namespace, if default namespaces do not apply? Are (either of) prefixed or non-prefixed attributes correct? For example, are the following equivalent: <html:br class="foo"...
3
1619
by: rene | last post by:
Hello everybody, i have these 2 xml files ------1.xml------ <?xml version="1.0" encoding="UTF-8"?> <root> <element>1</element> <element>2</element> </root>
9
2104
by: Tjerk Wolterink | last post by:
I have an xml document that conforms to my xschema document. Now i wanted to use xinclude in my xml document. But when i want to validate the xml document to the xschema i get the following error: -- Validating "structure.xml" against
0
1353
by: John | last post by:
Hi, I'm creating a component to generate a schema file much like VS generates for DataSets. I'm using XmlSchema to do the job and I also am using a XmlNamespaceManager to manage namespaces. XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt); nsmgr.AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); nsmgr.AddNamespace("msdata", "urn:schemas-microsoft-com:xml-msdata"); nsmgr.AddNamespace("mstns",...
4
4759
by: FabrizioSW | last post by:
Hi all i've to create a xml doc like this <?xml version="1.0" encoding="UTF-8"?> <Main xmlns:x="http://www.w3.org/1999/XML/xinclude"> <x:include href="one.xml"/> <x:include href="two.xml"/> <x:include href="more.xml"/> </Main> i tried to use xmlnamespacemanager and also to declare the namespace
11
1851
by: john fra | last post by:
Hi, I want to include a part of many XML files into an unique XML file with XInclude. Example! File1.xml, File2.xml, File3.xml... seems to that : <?xml version="1.0" encoding="UTF-8"?>
4
3386
by: Tim Arnold | last post by:
I'm using ElementTree to access some xml configuration files, and using the module's xinclude capability. I've got lines like this in the parent xml file (which lives in the same directory as the included xml file): <xi:include href="/dept/app/doc/current/en/xml/asdf/asdf_syntaxterms.xml"/> When I started the project it was Unix-only; this worked fine. Now I have users who want to use the system on Windows and of course that directory...
1
9327
by: marfi95 | last post by:
I am using XMLDocument to create my xml. How do I remove the namespace information ? It is being put on all my xml nodes: <MyServ xmlns="http://www....../XInclude> <Timeout xmlns="">100</Timeout <MyServ> I am using CreateElement as such xElem = newXMLConfigDoc.CreateElement("Timeout")
2
2772
by: McSwell | last post by:
I have an XML file that looks something like this: ------------------------ <?xml ...?> <!DOCTYPE ...> <src:fragment id="foo" ...> <Ph:Itemsome stuff </Ph:Item> <Ph:Itemsome more stuff </Ph:Item> .... <Ph:Itemstill more stuff </Ph:Item> </src:fragment>
0
9571
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
10318
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
10302
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
10069
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...
0
9132
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5505
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
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2976
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.