473,804 Members | 3,722 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to output unresolved xinclude element

I should like to use xslt to produce a document like the following:

<crate xmlns:xi="http://www.w3.org/2001/XInclude">
<rod id="0">
<slot>1</slot>
<xi:include href="./endcapA/disk/1a/10011.xml"/<!--D1A TR
middles-->
<xi:include href="./endcapA/disk/1a/10012.xml"/<!--D1A TR
middles-->
<xi:include href="./endcapA/disk/1a/10001.xml"/<!--D1A TR
outers-->
<xi:include href="./endcapA/disk/1a/10002.xml"/<!--D1A TR
outers-->
<xi:include href="./endcapA/disk/2a/20001.xml"/<!--D2A TR
outers-->
<xi:include href="./endcapA/disk/2a/20002.xml"/<!--D2A TR
outers-->
<xi:include href="./endcapA/disk/3a/30001.xml"/<!--D3A TR
outers-->
<xi:include href="./endcapA/disk/3a/30002.xml"/<!--D3A TR
outers-->
</rod>
</crate>

i.e. it should contain 'manufactured' unresolved xi:include elements.
How can I get my xsl to output such an element?

thanks

shaun
Mar 7 '07 #1
7 1873
i.e. it should contain 'manufactured' unresolved xi:include elements.
How can I get my xsl to output such an element?
The simplest answer: http://www.w3.org/TR/xslt#element-namespace-alias

An alternative is to construct the element explicitly using the
xsl:element directive.

Either will prevent the new element from being prematurely interpreted.

(These tricks are more often used when writing stylesheets that produce
stylesheets, but they're certainly applicable to this problem as well.)

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Mar 7 '07 #2

The namespace-alias seems neat, but I get a bit of ugliness with it:

I declare my namespaces:

<xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
version="1.0" xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xout="myA lias">

and my alias:

<xsl:namespac e-alias stylesheet-prefix="xout" result-prefix="xi"/>

and then use it...

<xout:include href="concat($M urPathRoot,$dis kpath,'/',xmlMur) "/>
and sure enough all my elements come out ok:

<xout:include href="./endcapA/disk/1a/10301"/>
but the root document element is:

<configuratio n xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xout="htt p://www.w3.org/2001/XInclude">

i.e. its declared both the original xi: and my xout: ... is this
expected?

thanks

shaun

In article <45eee4de$1@kcn ews01>,
Joseph Kesselman <ke************ @comcast.netwro te:
http://www.w3.org/TR/xslt#element-namespace-alias
Mar 7 '07 #3
shaun roe wrote:
i.e. its declared both the original xi: and my xout: ... is this
expected?
There's a similar directive which lets you suppress namespace
declarations that aren't in use. See the spec and/or Kay's book, or wait
a few hours for me to get around to looking it up.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Mar 7 '07 #4
Joseph Kesselman wrote:
There's a similar directive which lets you suppress namespace
declarations that aren't in use. See the spec and/or Kay's book, or wait
a few hours for me to get around to looking it up.
Since you waited: What you want is the exclude-result-prefixes attribute
of the xsl:stylesheet element. It's described in
http://www.w3.org/TR/xslt#section-Cr...and-Attributes

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Mar 8 '07 #5
In article <Y-*************** *************** @comcast.com>,
Joe Kesselman <ke************ @comcast.netwro te:
>There's a similar directive which lets you suppress namespace
declarations that aren't in use. See the spec and/or Kay's book, or wait
a few hours for me to get around to looking it up.
>Since you waited: What you want is the exclude-result-prefixes attribute
of the xsl:stylesheet element. It's described in
http://www.w3.org/TR/xslt#section-Cr...and-Attributes
I think this won't necessarily do quite the right thing in this case.
Despite its name, exclude-result-prefixes specifies a namespace uri to
be excluded, not a prefix. Since in this case he does need the
xinclude namespace, he may well still get a spurious xout prefix
declared somewhere.

-- Richard
--
"Considerat ion shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Mar 8 '07 #6
Richard Tobin wrote:
I think this won't necessarily do quite the right thing in this case.
Despite its name, exclude-result-prefixes specifies a namespace uri to
be excluded, not a prefix. Since in this case he does need the
xinclude namespace, he may well still get a spurious xout prefix
declared somewhere.
In the implementation I'm familiar with (Xalan), it should do the right
thing, because it's take as a request not to issue any declarations for
prefixes bound to that URI except those which are actually used by an
element or attribute. But while that's a reasonable interpretation It
may not be the only one... Best suggestion I can make is to try it and
see what happens.

If it doesn't work -- well, an unused namespace declaration really is
pretty harmless.
--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Mar 8 '07 #7
In article <H7************ *************** ***@comcast.com >,
Joe Kesselman <ke************ @comcast.netwro te:
Richard Tobin wrote:
I think this won't necessarily do quite the right thing in this case.
Despite its name, exclude-result-prefixes specifies a namespace uri to
be excluded, not a prefix. Since in this case he does need the
xinclude namespace, he may well still get a spurious xout prefix
declared somewhere.

In the implementation I'm familiar with (Xalan), it should do the right
thing, because it's take as a request not to issue any declarations for
prefixes bound to that URI except those which are actually used by an
element or attribute. But while that's a reasonable interpretation It
may not be the only one... Best suggestion I can make is to try it and
see what happens.

If it doesn't work -- well, an unused namespace declaration really is
pretty harmless.
I did indeed try this as a first move, and as Richard Tobin has said, it
did not suppress the declaration. (using Saxon) I can live with two
declarations of the namespace, its just not as neat as I'd hoped.

In fact, give that both namespaces are declared anyway in the output, I
found I can reverse the alias/output assignation:

<xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
version="1.0" xmlns:x="http://www.w3.org/2001/XInclude"
xmlns:xi="myAli as">

..
..
..

<xi:include href="concat($M urPathRoot,$dis kpath,'/',xmlMur) "/>
and get, as output:

<configuratio n xmlns:x="http://www.w3.org/2001/XInclude"
xmlns:xi="http://www.w3.org/2001/XInclude">
..
..
..
..
<xi:include href="./endcapA/disk/2a/20302"/>
which leaves my end users looking at the familiar <xi:include .../>,
which I suspect they will be happier with.

thanks for the help

shaun
Mar 8 '07 #8

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

Similar topics

1
2628
by: Erdem Guven | last post by:
I try to include some xml documents to another one and validate them. I get 'invalid content starting with element "xi:include".' error message at pointsample.xml line 6 from xml plugin of jedit which uses xerces lib. I can't find what is wrong. Here is my files: sample.xsd: <?xml version="1.0"?> <schema
1
1755
by: CB | last post by:
I am using xerces 2.5.0 and xalan 2.6.0, and am following the xinclude instructions on the xerces faq at http://xml.apache.org/xerces2-j/faq-xinclude.html, and I am having no luck. I imagine I must be missing something fundamental, can someone point it out, please? Here are all the gory details; ---- command line ----
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>
1
1491
by: Larry | last post by:
Given the "includer" xml file: <?xml version="1.0"?> <test-includer xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:testns="http://www.w3.org/TR/REC-xml-names" xmlns:xi="http://www.w3.org/2001/XInclude" > <xi:include href="test-included.xml"
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
2
2973
by: tllee | last post by:
I wrote a simple stack program using class template on VC++ 2003 but am unable to resolve the following link errors: LINK : error LNK2020: unresolved token (0A000046) Stack.__dtor LINK : error LNK2020: unresolved token (0A000048) Stack.__dtor LINK : fatal error LNK1120: 2 unresolved externals The following are my source codes: //-----------------------stack.h----------------------------------------------------
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...
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
9569
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
10558
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
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
9130
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...
1
7608
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
6844
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4277
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
3
2975
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.