|
How could an if statment comes true if there is a child node of current node. It must be general,
<xsl:if test="?">
...
and recursion works in <xsl:apply-template>.
karanba
|
|
|
|
|
XSL has a function called count. So you need to ask if a count of the child nodes is greater than 0.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
I have got one more question for you Christian. Here it is :
Thanks.
|
|
|
|
|
and if that doesn't work
.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
------------------------------
function Go(node){
var str = new String();
str+=node.nodeName+" ";
if(node.hasChildNodes()){
for(i=0;i
|
|
|
|
|
karanba wrote:
for(i=0;i {
that's never going to do anything. Ah - you've put < and > without ticking 'display this message as-is'. If you try again, I'd be happy to have a look at it when I can see it all.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
------------------------------
function Go(node){
var str = new String();
str+=node.nodeName+"
";
if(node.hasChildNodes()){
for(i=0;i
|
|
|
|
|
Either your compiler is broken or you did not follow my instructions and tick the box that says 'Display this message as-is (no HTML)'. I suspect the latter. The < in your for loop is finding a > to turn into a tag, and it's being stripped.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Hi All
I have an xml which is passed thru a sytlesheet and in the resultant file, two tags IDValue and IDScheme are not properly output.
Could you please help me out !
Thanks
<b>Enclosed - Source XML </b>
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="C:\ExpressPrototypes\Chi Interface Prototype 2\XMLFiles\RegisterPatientResponse.xsl"?>
<gen:RegisterPatientResponse xmlns:gen="http://www.show.scot.nhs.uk/isd/General" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- xsi:schemaLocation="http://www.show.scot.nhs.uk/isd/General CHIRegisterPatientResponse.xsd" -->
<!-- Contains standard patient response header and a patient body which contains the CHI Number -->
<gen:StandardPatientResponseHeader>
<gen:ReturnCode>SUCCESS</gen:ReturnCode>
<gen:ErrorCode>0001</gen:ErrorCode>
<gen:ErrorText/>
</gen:StandardPatientResponseHeader>
<!-- Standard patient response body containing the CHI Number -->
<gen:StandardRegisterPatientResponseBody>
<gen:PatientDetails>
<gen:PatientId>
<gen:IdValue>1601025017</gen:IdValue>
<gen:IdScheme>CHI</gen:IdScheme>
</gen:PatientId>
</gen:PatientDetails>
</gen:StandardRegisterPatientResponseBody>
</gen:RegisterPatientResponse>
<b>Enclosed Source XSL</b>
<?xml version="1.0" encoding="UTF-16"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:gen="http://www.show.scot.nhs.uk/isd/General" xmlns:req="http://www.isoftplc.com/Express/Chi/RegisterPatientResponse" xmlns:hdr="http://www.isoftplc.com/Express/Chi/Header" exclude-result-prefixes="gen hdr">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="*">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="text()|@*"/>
<xsl:template match="gen:RegisterPatientResponse">
<gen:RegisterPatientResponse>
<xsl:apply-templates/>
</gen:RegisterPatientResponse>
</xsl:template>
<xsl:template match="gen:StandardPatientResponseHeader">
<gen:StandardPatientResponseHeader>
<gen:ReturnCode>
<xsl:value-of select="./gen:ReturnCode"/>
</gen:ReturnCode>
<gen:ErrorCode>
<xsl:value-of select="./gen:ErrorCode"/>
</gen:ErrorCode>
<gen:ErrorText>
<xsl:value-of select="./gen:ErrorText"/>
</gen:ErrorText>
</gen:StandardPatientResponseHeader>
</xsl:template>
<xsl:template match="gen:StandardRegisterPatientResponseBody">
<gen:StandardRegisterPatientResponseBody>
<gen:PatientDetails>
<gen:PatientId>
<gen:IdValue>
<xsl:value-of select="./gen:IdValue"/>
</gen:IdValue>
<gen:IdScheme>
<xsl:value-of select="/gen:IdScheme"/>
</gen:IdScheme>
</gen:PatientId>
</gen:PatientDetails>
</gen:StandardRegisterPatientResponseBody>
</xsl:template>
</xsl:stylesheet>
The values IDValue and IDScheme are not properly output
|
|
|
|
|
Heya,
either change the XSL to:
...
<xsl:template match="gen:StandardRegisterPatientResponseBody">
<gen:StandardRegisterPatientResponseBody>
<gen:PatientDetails>
<gen:PatientId>
<gen:IdValue>
<xsl:value-of select="gen:PatientDetails/gen:PatientId/gen:IdValue"/>
</gen:IdValue>
<gen:IdScheme>
<xsl:value-of select="gen:PatientDetails/gen:PatientId/gen:IdScheme"/>
</gen:IdScheme>
</gen:PatientId>
</gen:PatientDetails>
</gen:StandardRegisterPatientResponseBody>
...
or, since you seems to make a copy of the stuff use the xsl:copy-of element.
Cheers
/WW
|
|
|
|
|
Hi folks, I have been hearing how good XML is when it comes to creating structured documents. My question is: I have tons of documents (text form), how do I port over to XML in the shortest time?
And, after porting, how do I update, edit it? It's not like SQL which I can code some interface (mainly in browser) to deal with it. I've been wondering this, can any kind soul answer me? Thanks.
--
Wei-Hui
|
|
|
|
|
Lim Wei-Hui wrote:
tons of documents (text form)
I presume there is a standard format that all your txt docs use? Like delimitors for different sections?
Lim Wei-Hui wrote:
how do I update, edit it?
It is actually pretty easy to update XML documents, so I don't think this is an issue.
All you'll need to do is:
load xml file into xmldom
manipulate nodes and or their values
save the xmldom back to the file
Can you perhaps post a snipett from the doc. and also explain a bit more about this application?
Cheers,
Simon
"The day I swan around in expensive suits is the day I hope someone puts a bullet in my head.", Chris Carter.
my svg article
|
|
|
|
|
Hi Simon, thanks for replying me.
My documents are mainly some header files in C/C++ that are filled with typedef and structs. I would like to set up an interface that enable me to select from browser which typedef and structure I wanna include in the new header file and hence generatin' it out as a *.h file.
Of course each typedef and structure has their unique function and properties, I presume (haven't looked into it).
I hope I've made myself clear. Thanks for your help again.
--
Wei-Hui
--
Wei-Hui
|
|
|
|
|
hi,everybody
Did you use "libxml" to parse your xml file ? I need your help .
how do I parse dtd file by libxml ?
after I parse dtd file ,how do I take use of result for parsing xml file ?
such as ,my dtd file is Goodxml2.dtd
-----------
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT bookshell (book*)>
<!ELEMENT book (author, title)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT title (#PCDATA)>
---------------------------------
my xml fils is Goodxml2.xml
-----------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE bookshell SYSTEM "GoodXml2.dtd">
<bookshell>
<book>
<author>Du Peng Chao</author>
<title>Today Story</title>
</book>
</bookshell>
----------------------------------------------
how do I parse dtd file by libxml ? then take use of parsing result to parse xml file for get element content ?
thank you very much
|
|
|
|
|
Regardless of what libxml is, I see an error in what you show : a DTD doesn't have headers like <?xml...
|
|
|
|
|
I use the "xml spy ide " tool to generate my dtd file
there has the headers
ant no error reported .
|
|
|
|
|
storein wrote:
ant no error reported
No error reported in what tool ? xml spy ?
Again, a DTD is not written with Xml syntax, so not only the <?xml header is useless, it may do bad things depending on the parser you use (libxml, msxml, expat, .NET xml, ...)
|
|
|
|
|
Yes. of course ,you are right ,
there is no this header .
when you write your program ,how do you use your DTD file that corresponds your xml file ? only validate the xml file ?
DTD file is GoodXml.dtd
-----------
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT bookshell (book*)>
<!ELEMENT book (author, title)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT title (#PCDATA)>
---------------------------------
XML file is GoodXml.xml
-----------------
<!DOCTYPE bookshell SYSTEM "GoodXml.dtd">
<bookshell>
<book>
<author>Du Peng Chao</author>
<title>Today Story</title>
</book>
</bookshell>
----------------------------------------------
do you use DTD file to validate only xml file ?
whether I can parse DTD file first ,get element "bookshell ,book,author,title ",then use
the element to parse xml file ?
in a word ,parse dtd file dynamicly ,parse xml file dynamicly ,then get element content .
thank you in advance .
|
|
|
|
|
I don't understand what you want to do, and as I don't know libxml either, I guess the discussion is in no way of getting a way out. The only thing I can tell you is that you should never parse a DTD yourself. You should rely on an existing xml parser for this purpose.
|
|
|
|
|
|
Just my 2 cents here but why a old DTD format? For my area we only use XSD for new work.
Second what goal are you wanting? If it is to validate the file then use the existing tools. If it is to make a data entry form then I can see some use.
"I will find a new sig someday."
|
|
|
|
|
Thank you reply .
I want to write c program that parse dynamicly dtd file , get the element ,and take use of these element to parse xml file for getting the element't content
such as :
DTD file is GoodXml.dtd
-----------
<!ELEMENT bookshell (book*)>
<!ELEMENT book (author, title)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT title (#PCDATA)>
---------------------------------
XML file is GoodXml.xml
-----------------
<!DOCTYPE bookshell SYSTEM "GoodXml.dtd">
<bookshell>
<book>
<author>Du Peng Chao</author>
<title>Today Story</title>
</book>
</bookshell>
----------------------------------------------
firstly , the program parse GoodXml.dtd file ,get element "bookshell ,book,author,title ",
secondly, use the element to parse xml file ,
get the content "Du Peng Chao" and "Today Story"
of course ,I use libxml ,not write parser myself.
in a word ,parse dtd file dynamicly ,parse xml file dynamicly ,then get element content .
thank you in advance .
|
|
|
|
|
From what you describe I can just parse the XML file and get the tags and data from it. I do not get anything from reading the DTD.
"I will find a new sig someday."
|
|
|
|
|
Now I think I am wrong . because as you say , I can parse the xml file and get tags and data from it ,I need't parse dtd file , Yes ,it is a comprehension error .
OK ,thank you reply , I know how to do it
|
|
|
|
|
Hi, I try to use Jscript and XML together.
For example:
--------------------------------
<books>
...
<book title="Harry Poter">
<book title="Harry Poter">
...
----------------------------------
how can I read title attributes by using XMLDOM object.
And do you refer me any good tutorial about XMLDOM object use in jscript.
karanba
|
|
|
|