473,404 Members | 2,114 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,404 software developers and data experts.

Transforming xhtml with xslt

http://www.biglist.com/lists/xsl-lis.../msg01242.html purports
to show how xslt can be used to copy all of an xhtml file & selectively
transform certain nodes. The copy works fine on its own, buit when I try to
follow the example and add another template to replace <navbarwith some
text stored in Navigation.htm, it seems to have no effect. Can some one
explain what I'm doing wrong? My XSLT stylesheets is included below.

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:include href="Navigation.htm" />

<xsl:output method="xml" indent="no"/>

<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>

<xsl:template match="navbar">
<xsl:copy>
<p>
<xsl:call-template name="topNavigation" />
</p>
<xsl:apply-templates select="node() != 'navbar'"/>
</xsl:copy>
</xsl:template>

</xsl:stylesheet>

May 28 '07 #1
6 1617

Puzzled wrote:
Can some one explain what I'm doing wrong?
Pretty much everything, I daresay. First of all, 'learning
by tinkering' does not imply *random* tinkering.
<xsl:include href="Navigation.htm" />
I doubt it does what you expect it to do. In fact, I'm
pretty certain of that, since I don't see document('')
anywhere in your stylesheet. At least I hope your .htm file
is well-formed XML.
<xsl:template match="navbar">
<xsl:copy>
<p>
<xsl:call-template name="topNavigation" />
Pardon me? I don't see any named templates in your
stylesheet.
</p>
<xsl:apply-templates select="node() != 'navbar'"/>
I doubt it does what you expect it to do (in more than one
way, too).

Since you failed to provide minimal complete example, it's
hard to tell precisely what you're doing wrong, but this
short snippet seems to demonstrate that at the very least
you need to do some reading first. Canned solutions work
just fine as long as you don't try to spice them up.

--
roy axenov

If only we smelled each other's asses, there wouldn't be any
war.--Dustin Hoffman
May 28 '07 #2
"Lord Snooty (roy axenov)" <r_******@mail.ruwrote in message
news:f3**********@aioe.org...
>
<snip>

Actually, I have done an enormous amount of reading. Unfortunately, the
sources to which I have access seem to be virtually worthless; badly
written, misleading and sometimes just plain wrong. However, at least those
authors don't seek to ridicule other people for knowing less than they do

May 29 '07 #3

Puzzled wrote:
"Lord Snooty (roy axenov)" <r_******@mail.ruwrote in
Oh, nice. Keep it up.
message news:f3**********@aioe.org...
Actually, I have done an enormous amount of reading.
I'm afraid there's something wrong with your reading
comprehension then. Either that, or you've been reading
mystery novels. Otherwise you wouldn't have asked a
question that is largely equivalent to 'I need to find gcd
of two numbers--32 and 48. Unfortunately, adding them and
looking at page 80 in volume 2 of Encyclopaedia Britannica
doesn't seem to work. What am I doing wrong?'
Unfortunately, the sources to which I have access seem to
be virtually worthless; badly written, misleading and
sometimes just plain wrong.
GIYF.
However, at least those authors don't seek to ridicule
other people for knowing less than they do
Not knowing something is not ridiculous in the least.
Failing to do even most basic research (such as looking up
node() in any XPath reference and xsl:include in any XSLT
reference) and asking nonsensical questions certainly is,
though.

HTH, HAND.

*plonk*

--
roy axenov

If only we smelled each other's asses, there wouldn't be any
war.--Dustin Hoffman
May 29 '07 #4
Puzzled wrote:
sources to which I have access seem to be virtually worthless
Pointers to the XML educational resources I use most often; order is not
particularly significant since which is best depends on what you're
looking for:

http://www.ibm.com/xml
Many tutorials/articles/tools, courtesy of Big Blue.
(Though not necessarily reflecting the official
opinions of IBM.)

http://xml.com/
A good place to look for meta-standard such
as commonly used schemas. Also hosts the Annotated
XML Spec, http://www.xml.com/axml/testaxml.htm

http://www.w3.org/
The Official Word on most things XML

http://www.saxproject.org/
The Official Word on SAX (which is not W3C-developed)

http://www.mulberrytech.com/xsl/xsl-list/
The original unofficial XSL users' mailing list.

http://www.dpawson.co.uk/xsl/
The XSL FAQ; "Condensed Cream of XSL-List"

http://xml.apache.org/
All things XML available from (or under development at)
Apache, including the dedicated mailing lists and
bug reporting/tracking systems for those tools.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
May 29 '07 #5
Starting point: read:
http://www.w3.org/TR/xslt#function-document
and understand why it's (very!!) different from
http://www.w3.org/TR/xslt#import
--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
May 29 '07 #6
Puzzled wrote:
Actually, I have done an enormous amount of reading. Unfortunately, the
sources to which I have access seem to be virtually worthless; badly
written, misleading and sometimes just plain wrong. However, at least those
authors don't seek to ridicule other people for knowing less than they do
A somewhat "snooty" but VERY good document on how to pose questions in a
way that's most likely to get useful answers from other newsgroup readers:

http://www.catb.org/~esr/faqs/smart-questions.html

I'll also remind folks that the same document has a section on writing
good answers. Generally, the simplest way to deal with a bad question is
either to ignore it, to point them at that document, or to point them at
the websearch they should have issued. Sniping generally just makes them
defensive, and they don't learn when they're being defensive.

Somewhat related to that, though it's about off-topic posts rather than
poorly structured questions:
http://www.lovesong.com/people/keshlam/filk/ravin.html

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
May 30 '07 #7

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

Similar topics

0
by: Bernd Fuhrmann | last post by:
Hi! I have two (or more) templates for one certain tag: The first one: tobeimported.xsl: <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet version="1.0"
5
by: Jody Greening | last post by:
Transforming with XSLT, Grouping elements until difference found. I am seeking some help with the following problem, I am fairly new at XSLT transformations, and my problem may lie in looking at...
2
by: Bond13579 | last post by:
Hi! I'm not an expert in XSL and XHTML so I need a little help! I have an XSL file that ends up using the ENTITY (varname) SYSTEM (file.xhtml) and then calls this variable which in turn outputs...
12
by: hawat.thufir | last post by:
I'm trying do some "screen scraping", and am using <http://www.oreilly.com/catalog/xmlhks/> for inspiration. First I'd like to convert XHTML to XML, or extract XML from XHTML, I'm not sure how...
12
by: Pierre Senellart | last post by:
I am going to teach a basic Web design course (fundamentals of HTML/CSS, plus some basic client-side (JavaScript) and server-side (PHP, perhaps XSLT) scripting). Most of the students do not have...
3
by: Sergio Otoya | last post by:
Hi all, I need to transform an xml document, using xsl to a HTML output. I can do this successfully using the XslTransform class as below: Dim oTrans As New XslTransform ...
5
by: Jiho Han | last post by:
I do a transform of an xml document into another xml using XslTransform. In my xsl file, I specify using <xsl:output encoding="utf-8"/>. However, when my transform is done, the resulting xml is in...
4
by: Cathie | last post by:
Hi All, I am trying to get my style sheet to work. It works fine in IE but I can't get it to work in .net. Below is the function I use for transforming, where advancedOptionsFile is the path...
0
by: mannem | last post by:
I have a problem in accessing the values while transforming an XML using XSLT BODY { FONT: x-small 'Verdana'; MARGIN-RIGHT: 1.5em } .c { CURSOR: hand } .b { FONT-WEIGHT: bold; COLOR: red;...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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,...
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.