When importing clean codes html with only one title mark <title>Title text</title>, it will works fine.
but when importing horrible html with too much title marks, it will grab other than <title>Title text</title> as title.
The html I'm importing has:
<title>Title text</title>
<h2 class='title'>Other text</h2>
'title': 'Just another text' <---this is in <script type='text/javascript'> of the html file
When importing, 'title': 'Just another text' is selected as title instead. this make all imported pages has same title
I have tried below code in the xsl but it grab <h2 class='title'>Title text</h2> instead:
<xsl:template name="get-title">
<xsl:value-of select="//title" />
</xsl:template>
I want it only choose <title>Title text</title> as title
Comments
Comment #1
dman commentedYeah, that should only get the
<title>element.There is some fallback code that tries for other options, but it's supposed to only try that if the early lookups fail.
The code in the generic html2simplehtml.xsl template does this
the "choose/when" means only one match will match.
Your version would also work, and is the expected way you would get what you want (as long as namespaces don't get in the way)
Attach your XSL and source doc and it may reveal what's going wrong
Comment #2
dman commentedThe example starter is easier to look at.
H1 or TITLE, in that order
Comment #3
apasaja commentednow it works.. thanks for the 2dn codes