473,405 Members | 2,160 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

miss something about xslt

Hi all
I have this xml file (generated from Lotus Domino 6) and would like to
transform it to a simpler one by extracting only data between the gif
tag (I cut the gif data to reduce the file here);
I wrote an xls to do it to transform the xml file.
What am I doing wrong ? because what I get is all the data in the xml
file instead of my expected output file :o((

Need your help
Ndeye, a new "xslter"

*my xml input file :
<?xml version="1.0" ?>
<!DOCTYPE document (View Source for full doctype...)>
- <document xmlns="http://www.lotus.com/dxl" version="6.5"
replicaid="C1256DC700510DFF" form="Person" response="false"
conflict="false">
+ <noteinfo noteid="356e" unid="60C4C68E08994352C1256E00003026AB"
sequence="2">
+ <updatedby>
+ <item name="full_name" sign="false" seal="false" sealed="false"
authors="false" names="false" readers="false" placeholder="false">
- <item name="Picture" sign="false" seal="false" sealed="false"
authors="false" names="false" readers="false" placeholder="false">
- <richtext>
- <pardef id="1" leftmargin="1%" rightmargin="99%" keeptogether="true"
align="left" linespacing="1" spacebefore="1" spaceafter="1"
newpage="false" list="none" readingorder="lefttoright">
- <code event="hidewhen">
<formula>(!@IsDocBeingEdited &
NoPhotoThanks="NoPhoto")|(@IsDocBeingEdited & isweb)</formula>
</code>
</pardef>
- <par def="1">
- <picture width="182px" height="136px" align="baseline">
<gif>R0lGODlhtgCIAOcAAP///4CAgIiIiGhoYFBQSKioiCgoKCAgGBAICCgoIPD4+Hh4eAAAAKC ggHh4
cIiIgCAgIDAwKBgQEHBwaJiYeICAcPDw8JiYgJCQiAgICHBwcG BgWJCQkDAoIICAeBgYEFBQQEhQ</gif>
</picture>
</par>
<par />
</richtext>
</item>
+ <item name="jobdescrip_me" sign="false" seal="false" sealed="false"
authors="false" names="false" readers="false" placeholder="false">
+ <item name="Phone_Me" sign="false" seal="false" sealed="false"
authors="false" names="false" readers="false" placeholder="false">
+ <item name="EMail_me" sign="false" seal="false" sealed="false"
authors="false" names="false" readers="false" placeholder="false">
+ <item name="ShowHasPic" sign="false" seal="false" sealed="false"
authors="false" names="false" readers="false" placeholder="false">
+ <item name="$Revisions" sign="false" seal="false" sealed="false"
authors="false" names="false" readers="false" placeholder="false">
</document>
*my xsl input file :
<?xml version="1.0" encoding="UTf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates select="gif"/>
</xsl:template>
<xsl:template match="gif">
<gifdata>
<xsl:value-of select="."/>
</gifdata>
</xsl:template>
</xsl:stylesheet>

*my expected xml ouput :
<?xml version="1.0" encoding="UTf-8"?>
<gifdata>
R0lGODlhtgCIAOcAAP///4CAgIiIiGhoYFBQSKioiCgoKCAgGBAICCgoIPD4+Hh4eAAAAKC ggHh4
cIiIgCAgIDAwKBgQEHBwaJiYeICAcPDw8JiYgJCQiAgICHBwcG BgWJCQkDAoIICAeBgYEFBQQEhQ
</gifdata>
Jul 20 '05 #1
3 1700
xsl:value-of is an xslt instruction, which produces the string value of a
node -- this is the concatenation (in document order) of all of its text
node descendents.

And this is what you get.

What you really wanted was to use the:

xsl:copy-of

instruction.

Dimitre Novatchev.
FXSL developer, XML Insider,

http://fxsl.sourceforge.net/ -- the home of FXSL
Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html
"Ndeye" <ns******@hotmail.com> wrote in message
news:93**************************@posting.google.c om...
Hi all
I have this xml file (generated from Lotus Domino 6) and would like to
transform it to a simpler one by extracting only data between the gif
tag (I cut the gif data to reduce the file here);
I wrote an xls to do it to transform the xml file.
What am I doing wrong ? because what I get is all the data in the xml
file instead of my expected output file :o((

Need your help
Ndeye, a new "xslter"

*my xml input file :
<?xml version="1.0" ?>
<!DOCTYPE document (View Source for full doctype...)>
- <document xmlns="http://www.lotus.com/dxl" version="6.5"
replicaid="C1256DC700510DFF" form="Person" response="false"
conflict="false">
+ <noteinfo noteid="356e" unid="60C4C68E08994352C1256E00003026AB"
sequence="2">
+ <updatedby>
+ <item name="full_name" sign="false" seal="false" sealed="false"
authors="false" names="false" readers="false" placeholder="false">
- <item name="Picture" sign="false" seal="false" sealed="false"
authors="false" names="false" readers="false" placeholder="false">
- <richtext>
- <pardef id="1" leftmargin="1%" rightmargin="99%" keeptogether="true"
align="left" linespacing="1" spacebefore="1" spaceafter="1"
newpage="false" list="none" readingorder="lefttoright">
- <code event="hidewhen">
<formula>(!@IsDocBeingEdited &
NoPhotoThanks="NoPhoto")|(@IsDocBeingEdited & isweb)</formula>
</code>
</pardef>
- <par def="1">
- <picture width="182px" height="136px" align="baseline">
<gif>R0lGODlhtgCIAOcAAP///4CAgIiIiGhoYFBQSKioiCgoKCAgGBAICCgoIPD4+Hh4eAAAAKC
ggHh4 cIiIgCAgIDAwKBgQEHBwaJiYeICAcPDw8JiYgJCQiAgICHBwcG BgWJCQkDAoIICAeBgYEFBQQEhQ
</gif> </picture>
</par>
<par />
</richtext>
</item>
+ <item name="jobdescrip_me" sign="false" seal="false" sealed="false"
authors="false" names="false" readers="false" placeholder="false">
+ <item name="Phone_Me" sign="false" seal="false" sealed="false"
authors="false" names="false" readers="false" placeholder="false">
+ <item name="EMail_me" sign="false" seal="false" sealed="false"
authors="false" names="false" readers="false" placeholder="false">
+ <item name="ShowHasPic" sign="false" seal="false" sealed="false"
authors="false" names="false" readers="false" placeholder="false">
+ <item name="$Revisions" sign="false" seal="false" sealed="false"
authors="false" names="false" readers="false" placeholder="false">
</document>
*my xsl input file :
<?xml version="1.0" encoding="UTf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates select="gif"/>
</xsl:template>
<xsl:template match="gif">
<gifdata>
<xsl:value-of select="."/>
</gifdata>
</xsl:template>
</xsl:stylesheet>

*my expected xml ouput :
<?xml version="1.0" encoding="UTf-8"?>
<gifdata>
R0lGODlhtgCIAOcAAP///4CAgIiIiGhoYFBQSKioiCgoKCAgGBAICCgoIPD4+Hh4eAAAAKC ggHh4 cIiIgCAgIDAwKBgQEHBwaJiYeICAcPDw8JiYgJCQiAgICHBwcG BgWJCQkDAoIICAeBgYEFBQQEhQ </gifdata>

Jul 20 '05 #2
In article <93**************************@posting.google.com >,
Ndeye <ns******@hotmail.com> wrote:

% What am I doing wrong ? because what I get is all the data in the xml
% file instead of my expected output file :o((

Is it really this XSLT that gives you all the data? You haven't given
a complete sample file, so I'm not going to bother trying to run it,
but I'd expect the XSLT you gave to give no output at all.

% <xsl:template match="/">
% <xsl:apply-templates select="gif"/>
% </xsl:template>

This apply-templates will select all the `gif' elements that appear
as children of the root. Since there are none, it should match nothing.

If you really left out this template, and you got all the text in the
document in addition to your new gifdata element, the problem is that,
by default, XSLT adds all text elements to the result tree. You need
to either fix the select expression above (select='document/picture/gif'),
or add a template to handle text elements

<xsl:template match='text()'/>

--

Patrick TJ McPhee
East York Canada
pt**@interlog.com
Jul 20 '05 #3
Of course, Patrick is right.

Ndeye,
I didn't bother look into your xml document, as it was absolutely
unreadable. In the future at least try to provide well-indented and readable
xml documents, not a copy of a collapsible/expandable outline, in which some
nodes are collapsed and some are expanded. Also, the "+" and "-" signs
contribute to the confusion.

If your source was *really* this:
% <xsl:template match="/">
% <xsl:apply-templates select="gif"/>
% </xsl:template>
then no output should be produced when applied on the provided xml document.

Therefore, most probably you're not showing the real xml document and/or the
real xslt code.

Dimitre Novatchev.
FXSL developer, XML Insider,

http://fxsl.sourceforge.net/ -- the home of FXSL
Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html
"Patrick TJ McPhee" <pt**@interlog.com> wrote in message
news:br**********@news.eusc.inter.net... In article <93**************************@posting.google.com >,
Ndeye <ns******@hotmail.com> wrote:

% What am I doing wrong ? because what I get is all the data in the xml
% file instead of my expected output file :o((

Is it really this XSLT that gives you all the data? You haven't given
a complete sample file, so I'm not going to bother trying to run it,
but I'd expect the XSLT you gave to give no output at all.

% <xsl:template match="/">
% <xsl:apply-templates select="gif"/>
% </xsl:template>

This apply-templates will select all the `gif' elements that appear
as children of the root. Since there are none, it should match nothing.

If you really left out this template, and you got all the text in the
document in addition to your new gifdata element, the problem is that,
by default, XSLT adds all text elements to the result tree. You need
to either fix the select expression above (select='document/picture/gif'),
or add a template to handle text elements

<xsl:template match='text()'/>

--

Patrick TJ McPhee
East York Canada
pt**@interlog.com

Jul 20 '05 #4

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

Similar topics

2
by: ted | last post by:
Was wondering if XSLT alone is appropriate for the following situation. From XML, I'm creating a small website (around 50 pages) with pages that link to each other through a nav menu and a...
2
by: Tom Corcoran | last post by:
I am working to ease updating of a html page by transforming 2 xml files. I was going to use xslt for this and had bought 2 unopened books, wrox xslt and o'reilly's xslt cookbook. But am now...
1
by: Mohit | last post by:
Hi Friends I have to call 1 of the 2 child XSLT files from the Main XSLT file based on some criteria. I want one child XSLT file will be executed by version 1 of XSLT processor and the other by...
1
by: Sonu Kapoor | last post by:
Ok guys, I could bang my head on the laptop, cause I dont get this to work. The scanrio: I am tryting to pass an parameter with the help of XslTransform to the xsl file. But whenever I run the...
3
by: Teksure | last post by:
Hi group, searching in the Internet I found two products for XML which incorporate a very robust debugger for XSL/XSLT, I would like you to see these products and then, give me your opinion about...
1
by: Dan Beanweed | last post by:
I have this xslt : <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:param name="p" select="'q'"/> <xsl:output...
1
by: Sergey Dubinets | last post by:
In effort to prioritize our goals we composed the list of random features each of them may add value to set of XSLT tools offered from Microsoft. 1. XSLTc (Compiler for XSLT...
5
by: Simon Brooke | last post by:
This is supposed to be a very simple XSL stylesheet to strip styling information out of HTML documents - it could not be more basic. And yet, it doesn't work. I'm obviously getting something very...
6
by: John Larson | last post by:
Hi All, I am some information from INSPEC database records in XML to build a relational database of my own. I am currently trying to extract information by doing an XSLT transform of the XML...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
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...

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.