I have a (fairly) well marked-up site with the following structure for the
static html pages:

...
<body>
    <div class="header">
        Header stuff, incl. <h1 id="songtitle"></h1>
    </div>
    <div class="content">
        <div class="references"> </div>
        <div class="songversion">
            <h2 class="songversion-title">Title</h2>
            <div class="preamble"> </div>
            <div class="chords"> </div>
            <div class="song">
                la la la
            </div>
        </div>
        <div class="songversion">
            <h2 class="songversion-title">Title</h2>
            <div class="preamble"> </div>
            <div class="chords"> </div>
            <div class="song">
                la la la
            </div>
        </div>
        etc. with more songversions
    </div>
</body>

I would like to
1. turn the class="songversion" divs into separate nodes
2. use the h2 class="songversion-title" as the node title,
3. turn the other divs under the songversion into CKK fields,
3. bring in the general h1 as a CCK field field_songtitle in all the nodes,
4. and the same for the "references" div in as a field in all the nodes.

I've tried to tweak the proof-of-concept template linked here: #138174: "This node has no body" error when importing HTML ( ../ path rewriting error) and discussed here: #139770: problems with multiple nodes from one HTML file, to someting like

<exsl:documents>
		<xsl:for-each select = "//xhtml:div[@class='songversion']">
		<exsl:document>
			<xsl:call-template name="html_doc"/>
		</exsl:document>
		<xsl:text>

and tweaked the get-content template, but I can't get anything through. The module does seem to try to create several nodes, but it can't find any contents. This is my first attempt at doing something with XSL, and I could use a pointer to where I'm going wrong, and what I should do instead.

I attach the file in a state which currently gives the following output:

Imported 6 items

warning: DOMDocument::loadXML() [domdocument.loadxml]: ID pagetitle already defined in Entity, line: 31 in E:\wamp\www\dc_d6\sites\all\modules\import_html\coders_php_library\xml-transform.inc on line 165.

and several more lines like this one. Despite the "imported 6 items" line, I only get one file, which only contains the title of the first of the six songversions and the contents of chordcharts, but none of the other divs/spans with classes matching my content type.

CommentFileSizeAuthor
love2learn2simplehtml-modified.xsl_.txt4.91 KBeyolf

Comments

dman’s picture

Status: Active » Needs work

Clearing the old 6.x issues from the issue queue for a cleanup.
But bumping this to 7 as the multi-document feature has not been tested for a long while. It could do with a test case.