Closed (fixed)
Project:
Import HTML
Version:
5.x-1.2
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
12 Jul 2007 at 09:07 UTC
Updated:
25 Sep 2007 at 01:31 UTC
Hello,
I've a problem with emptys anchors.
The documents I want to import have anchors like 'Basic Skill'. After importing the closing is deleted so that it is now 'Basic Skill'. I think thats a problem with the XSL stylesheets but I can't find it.
Do anyone have an idea what i can do to fix the problem?
Comments
Comment #1
dman commentedAnorexic Anchors are bad mojo semantically.
In XML/XHTML ,
<a name='this' href='that'></a>is structurally identical to<a name='this' href='that' />Some browsers may or may not parse that right. Probably also makes a differents which compliance mode your DOCTYPE is in.
Your code paste didn't come through very well, so I'm not sure what your real problem is.
You can probably come up with a fix in your XSL import template
.. or something. Some assembly required on that pseudo-code.
Better to actually fix the problem of unsemantic markup, however.
Comment #2
tafkad@drupalcenter.de commentedYes, I've forgotten to use the Code Tags while I wrote.
The problem is that I've many large documents which use the following Type of anchor:
<a name="basic_skills"></a><h2>headline</h2>After I import that the same line shows the following content:
<a name="basic_skills"><h2>headline</h2>The main problem is after the import the closing
</a>is deleted, only by anchors with no content between the leading and ending a tag.A line like the following one makes no problems:
<a name="next skills">content</a>The problem only applies if there is no content between the
<a></a>tags, then the last tag</a>is deleted after importing.I hope you understand my problem now better.
Comment #3
dman commentedThat code is deprecated. Empty tags were sorta OK in the 90s before CSS could hide the underlines from anchors, but nowadays, if you are going to link to something, link to IT, with an ID, not to a floating tag positioned next to it.
Is what you should be doing.
However the point of import_html is to take bad old sites and make them good, so here's a work-around which, although it won't make your semantics any better, it won't break existing expected behaviour.
Work-around for anorexic anchors
Paste this into
rewrite_href_and_src.xslOr download the patched replacement from here or from CVS DRUPAL-5Instead of collapsing
<a name='doh'></a>into the (technically correct) XML singleton
<a name='doh' />pad it with
<a name='doh'><!-- placeholder --></a>So things will continue to work as expected.
<a name='doh' />doesn't have a good effect in many browsers ... it's read as being left open and bad things happen.... that should do the job. Please try it out.
Comment #4
tafkad@drupalcenter.de commentedThank you
The problem seems to be solved.
Comment #5
dman commentedComment #6
(not verified) commented