Extended support for importing extra fields - CCK & Meta info
zozo - September 10, 2007 - 21:23
| Project: | Import HTML |
| Version: | 5.x-1.2 |
| Component: | Documentation |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
I'm trying to use the import module
but really have no idea how to import
in a cck field call field_chapo
a part of my html page like this
<div class="chapo">my texte blablabla.</div>
I have try something like this in my xsl template join
but because I doesn't really understand how it work exactly, I' ll appreciate one or two complete examples to help me start and understand
thanks for all
cyril
| Attachment | Size |
|---|---|
| html2simplehtml2.txt | 10.03 KB |

#1
If your source html is tagged like that, then yes, I would expect the cck field to be found and absorbed like you describe.
However, it would require the 'tagged' content block to be making its way into the post-translation semantic phase. This may not be happening if you are already successfully extracting a 'body' field that does not include the tagged field. Sorry, it's tricky to explain.
I guess you've seen how it's SUPPOSED to work in the docs
Based on the
customtemplate2simplehtml.xsl example, try inserting the 'chapo' filed again by hand. Normally, when all source is in the 'body' block already, this would by unneccessary, but this way is explicit and deals with cases where the body copy and extra data are already separate.
... xsl preamble ...
<xsl:template name="html_doc" match="/">
<html>
<body>
... other extractions ...
<div class="chapo">
<xsl:value-of select="//@class='chapo'" />
</div>
</body>
</html>
</xsl:template>
Maybe attach one of your source docs and I'll see what to expect from it.
I agree a better example or two would be good, I need to draw pictures to really explain the full story...
#2
note that xsl:value-of will just retrieve the stripped text, use xsl:copy-of if it's got further HTML markup in it you want to keep.
#3
thanks for your help
in fact i'm trying to migrate from cms spip to drupal so I can structure page
first
with a div
<div class="field_chapo">around the texte I want to put in the cck field chapo it work
but still have few question
how can i import the author
I have try to put in my content something
<div id="name">a name</div>whitout succes
and another question how do i import the date of creation
what is the default format expected
thank again for your help
#4
Good questions. Coming from another CMS is a very tidy source, so I'd be interested in seeing this work, eg to create profiles/templates for direct imports from other systems.
So far, the author is hard-coded ( import_html_xhtml_to_node ), mostly to make sure that it's always valid. It makes sense to allow the author to optionally be imported, but it would require all valid users to be made, possibly on-the-fly, and that could be messy if the algorithm got it wrong, eg by finding something in the code with
class="name"and deciding that was the author!Anyway, that can be done, but my dev machine is currently off-line.
Likewise, importing the date would make sense, I guess, but simply hasn't been tested/developed. It SHOULD just work if you can manipulate the date field into a Drupal node property labelled "changed". Or possibly "date". My idea was to embed it as a proper META tag in the clean-html stage (METAs also get imported). The framework to do so is there and working, but not fully developed.
Looking at node_submit(), The format of $node->date gets read in by strtotime() so pretty much anything should work.
I've not tested however, it may need a tweak to work just right.