leadParagraph is optional there can be 0 or 1 leadparagraphs and thanks very much for your help it worked. Please check your mail account ;) (For my second question above) Can anyone briefly tell me how can I do an iterative loop in XSL?
My 2nd problems is that I need an iterative loop. That means I have another XML source which has the headlines and when I click onto a headline, a pop up window is opened to see the article of that headline. Normally I could have done it via
do{
myTable = myTest.appendChild(document.createElement("table") );
myTable.style.borderBottom = "none";
myTable.setAttribute("id","epoNewsItem");
article1[i] = xmldoc.selectNodes("//fcs:folder/fcs:folderHeadlinesResultSet/fcs:folderHeadline/fcs:contentParts/fcs:part/@reference")[i].value;
myRow = myTable.insertRow(0);
//myArray1[i] = xmldoc.selectNodes("//fcs:folder/fcs:folderHeadlinesResultSet/fcs:folderHeadline/fcs:baseLanguage")[i];
//myArray2[i] = xmldoc.selectNodes("//fcs:folder/fcs:folderHeadlinesResultSet/fcs:folderHeadline/fcs:wordCount")[i];
myArray3[i] = xmldoc.selectNodes("//fcs:folder/fcs:folderHeadlinesResultSet/fcs:folderHeadline/fcs:publicationDate")[i];
var dateText = myArray3[i].text;
var year = dateText.substring(0,4);
var month = dateText.substring(5,7);
var day = dateText.substring(8,10);
//myArray4[i] = xmldoc.selectNodes("//fcs:folder/fcs:folderHeadlinesResultSet/fcs:folderHeadline/fcs:publicationTime")[i];
myArray6[i] = xmldoc.selectNodes("//fcs:folder/fcs:folderHeadlinesResultSet/fcs:folderHeadline/fcs:contentParts/@contentType")[i];
if(myArray6[i].value == "WebPage"){
icon = "http://dg1-2.internal.epo.org/_test/Huerol/Factiva/fwebicon.gif";
alt = "Factiva Web Content Icon";
}
else {
icon = "http://dg1-2.internal.epo.org/_test/Huerol/Factiva/fac_pub.gif";
alt = "Factiva Publications Icon";
}
myCell1 = myRow.insertCell(0);
myCell1.className = "text";
myCell1.innerHTML = "<img src='"+icon+"' alt ='"+alt+"' align='left' style='margin-top:3px' /> "+day+"."+month+"."+year;
myCell1.innerHTML += "<br clear='all' />";
myArray5[i] = xmldoc.selectNodes("//fcs:folder/fcs:folderHeadlinesResultSet/fcs:folderHeadline/fcs:headline/fcs:paragraph")[i];
str[i] = myArray5[i].text;
header[i] = str[i].substring(0,50);
//myCell1.innerHTML += "<h3>" + myArray5[i].text + "</h3> <p><a href = javascript:sendContentRequest("+i+") class='more'>more...</a></p>"; myCell1.innerHTML += "<h3><a href = javascript
:sendContentRequest("+i+") class='more'>" + header[i] + "...</a></h3>";
myArray7[i] = xmldoc.selectNodes("//fcs:folder/fcs:folderHeadlinesResultSet/fcs:folderHeadline/fcs:snippet")[i];
if(myArray7[i]==null){
return false;
}
else{
var cPos = myArray7[i].text.indexOf("-- ");
if (cPos >= 0)
snippet[i] = myArray7[i].text.substring(cPos + 3,100 + cPos + 3);
else
snippet[i] = myArray7[i].text.substring(0,100);
myCell1.innerHTML += "<p>"+snippet[i]+"...</p>";
}
myTest.appendChild(myTable);
i++;
} while(i<size)
What I should do in my other XSL to reference the links to a javascript function which takes the i th headline to send it to the i th article XSL data. What I have written in XSL was
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="2.0" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fcs="urn:factiva:developer:v3_0:parsers" xmlns:msxsl="urn:schemas-microsoft-com:xslt" >
<xsl:output method="html" version="4.0" />
<xsl:template match ="/">
<xsl:apply-templates select="SOAP-ENV:Envelope/SOAP-ENV:Body/fcs:GetFolderHeadlinesResponse/fcs:folderHeadlinesResponse/fcs:folderHeadlinesResult/fcs:folder/fcs:folderHeadlinesResultSet"></xsl:apply-templates>
</xsl:template>
<xsl:template match="SOAP-ENV:Envelope/SOAP-ENV:Body/fcs:GetFolderHeadlinesResponse/fcs:folderHeadlinesResponse/fcs:folderHeadlinesResult/fcs:folder/fcs:folderHeadlinesResultSet">
<head>
<title>Factiva Test</title>
<link href='http://intranet1-t.internal.epo.org/portal/themes/html/epoIntranetCD/cssTheme.css' rel="stylesheet" type="text/css" />
<link href='http://intranet1-t.internal.epo.org/portal/themes/html/epoIntranetCD/cssPageBody.css' rel="stylesheet" type="text/css" />
</head>
<body>
<img src="http://dg1-2.internal.epo.org/_test/Huerol/Factiva/fac1.bmp" align="right" />
<br clear="all"/>
<table id="epoNewsItem" style="border-bottom:none">
<xsl:for-each select="fcs:folderHeadline">
<xsl:variable name="content" select="fcs:contentParts/@contentType"/>
<xsl:variable name="year" select="substring(fcs:publicationDate,0,5)"/>
<xsl:variable name="month" select="substring(fcs:publicationDate,6,2)"/>
<xsl:variable name="day" select="substring(fcs:publicationDate,9,2)"/>
<tr>
<xsl:choose>
<xsl:when test="$content='WebPage'">
<td class="text"><img src="http://dg1-2.internal.epo.org/_test/Huerol/Factiva/fwebicon.gif" alt="Factiva Web Content Icon" style='margin-top:3px'/><xsl:text></xsl:text><xsl:value-of select="$day"/>.<xsl:value-of select="$month"/>.<xsl:value-of select="$year"/></td>
</xsl:when>
<xsl:otherwise>
<td class="text"><img src="http://dg1-2.internal.epo.org/_test/Huerol/Factiva/fac_pub.gif" alt="Factiva Publications Icon" style='margin-top:3px'/><xsl:text></xsl:text><xsl:value-of select="$day"/>.<xsl:value-of select="$month"/>.<xsl:value-of select="$year"/></td>
</xsl:otherwise>
</xsl:choose>
</tr>
<tr>
<xsl:variable name="headline" select="fcs:headline/fcs:paragraph"/>
<xsl:variable name="cut" select="substring($headline,0,50)"/>
<td class="text"><h3><a href=""><xsl:value-of select="$cut"/><xsl:text>...</xsl:text></a></h3></td>
</tr>
<tr>
<xsl:variable name="snippet" select="fcs:snippet"/>
<xsl:variable name="cPos" select="index-of($snippet, '-')"/>
<xsl:choose>
<xsl:when test="$cPos >= 0">
<xsl:variable name="cutSnippet" select="substring($snippet,$cPos+3,100+$cPos+3)"/>
<td class="text"><xsl:value-of select="$cutSnippet"/></td>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="cutSnippet" select="substring($snippet,0,100)"/>
<td class="text"><xsl:value-of select="$cutSnippet"/></td>
</xsl:otherwise>
</xsl:choose>
</tr>
</xsl:for-each>
</table>
</body>
</xsl:template>
</xsl:stylesheet>
Its XML file is
<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<GetFolderHeadlinesResponse xmlns="urn:factiva:developer:v3_0:parsers">
<folderHeadlinesResponse>
<folderHeadlinesResult>
<folder>
<folderName>GroupFolder</folderName>
<folderID>100085070</folderID>
<highlightString>T|test T|article N|fmt O|c T|report N|fmt O|c O|, T|file N|fmt O|c O|, T|webpage N|fmt O|c O|, O|+ T|en N|la O|c O|+</highlightString>
<bookmark>20060831040744.124+20060831040744.124+ 5</bookmark>
<contact>
[email protected]</contact>
<editorPostMethod>Automatic</editorPostMethod>
<queryHitCount>172</queryHitCount>
<moreHeadlines>true</moreHeadlines>
<folderHeadlinesResultSet count="5">
<folderHeadline>
<baseLanguage>en</baseLanguage>
<ipDocumentID>20060831782688</ipDocumentID>
<accessionNo>NYTF000020060831e28v0004s</accessionNo>
<wordCount>1366</wordCount>
<publicationDate>2006-08-31</publicationDate>
<sourceCode>nytf</sourceCode>
<sourceName>The New York Times</sourceName>
<sectionName>National Desk; SECTA</sectionName>
<headline>
<paragraph lang="en">Students' Paths To Small Colleges Can Bypass SAT </paragraph>
</headline>
<snippet>
<paragraph>It is still far too early to sound the death knell, but for many small liberal arts colleges, the SAT may have outlived its usefulness. </paragraph><paragraph>Since Bowdoin and Bates dropped their testing requirements decades ago, more than a fourth of U.S. News ...</paragraph>
</snippet>
<byline>By TAMAR LEWIN </byline>
<copyright>(c) 2006 New York Times Company </copyright>
<contentParts contentType="Article" primaryReference="distdoc:archive/ArchiveDoc::Article/NYTF000020060831e28v0004s">
<part type="NewsArticle" size="9233" reference="distdoc:archive/ArchiveDoc::Article/NYTF000020060831e28v0004s"></part>
</contentParts>
<editor>
<contentID>45665568</contentID>
<priority>None</priority>
</editor>
</folderHeadline>
<folderHeadline>
<baseLanguage>en</baseLanguage>
<ipDocumentID>BLDW000020060831e28v0000z</ipDocumentID>
<accessionNo>BLDW000020060831e28v0000z</accessionNo>
<wordCount>429</wordCount>
<publicationDate>2006-08-31</publicationDate>
<sourceCode>bldw</sourceCode>
<sourceName>Blood Weekly</sourceName>
<headline>
<paragraph lang="en">HIV/AIDS Anemia; Direct antiglobulin-positive results may be related to lower hemoglobin levels in HIV/AIDS </paragraph>
</headline>
<snippet>
<paragraph>2006 AUG 31 - (NewsRx.com) -- Direct antiglobulin-positive results may be related to lower hemoglobin levels in HIV-infected patients. </paragraph>
<paragraph>"There are conflicting opinions regarding the effect of positive direct antiglobulin test (DAT) on ...</paragraph>
</snippet>
<copyright>(c) Copyright 2006 Blood Weekly via NewsRx.com </copyright>
<contentParts contentType="Article" primaryReference="distdoc:archive/ArchiveDoc::Article/BLDW000020060831e28v0000z">
<part type="NewsArticle" size="3423" reference="distdoc:archive/ArchiveDoc::Article/BLDW000020060831e28v0000z"></part>
</contentParts>
<editor>
<contentID>45665106</contentID>
<priority>None</priority>
</editor>
</folderHeadline>
<folderHeadline>
<baseLanguage>en</baseLanguage>
<ipDocumentID>20060831780375</ipDocumentID>
<accessionNo>NYTF000020060831e28v0002b</accessionNo>
<wordCount>445</wordCount>
<publicationDate>2006-08-31</publicationDate>
<sourceCode>nytf</sourceCode>
<sourceName>The New York Times</sourceName>
<sectionName>Editorial Desk; SECTA</sectionName>
<headline>
<paragraph lang="en">Raising Nicotine Doses, on the Sly </paragraph>
</headline>
<snippet>
<paragraph>While most of us thought the country was trying to curb smoking, and the rapacious habits of the tobacco companies, it turns out the industry has been sneakily making cigarettes more addictive. </paragraph>
</snippet>
<copyright>(c) 2006 New York Times Company </copyright>
<contentParts contentType="Article" primaryReference="distdoc:archive/ArchiveDoc::Article/NYTF000020060831e28v0002b">
<part type="NewsArticle" size="3450" reference="distdoc:archive/ArchiveDoc::Article/NYTF000020060831e28v0002b"></part>
</contentParts>
<editor>
<contentID>45664981</contentID>
<priority>None</priority>
</editor>
</folderHeadline>
<folderHeadline>
<baseLanguage>en</baseLanguage>
<ipDocumentID>20060831780367</ipDocumentID>
<accessionNo>NYTF000020060831e28v0002a</accessionNo>
<wordCount>499</wordCount>
<publicationDate>2006-08-31</publicationDate>
<sourceCode>nytf</sourceCode>
<sourceName>The New York Times</sourceName>
<sectionName>Editorial Desk; SECTA</sectionName>
<headline>
<paragraph lang="en">Stars in Their Eyes </paragraph>
</headline>
<snippet>
<paragraph>In a rare moment of candor this week, Defense Secretary Donald Rumsfeld acknowledged that he's not sure if the United States missile defense system is ready to work. When asked if the shield could protect the United States from a North ...</paragraph>
</snippet>
<copyright>(c) 2006 New York Times Company </copyright>
<contentParts contentType="Article" primaryReference="distdoc:archive/ArchiveDoc::Article/NYTF000020060831e28v0002a">
<part type="NewsArticle" size="3540" reference="distdoc:archive/ArchiveDoc::Article/NYTF000020060831e28v0002a"></part>
</contentParts>
<editor>
<contentID>45664980</contentID>
<priority>None</priority>
</editor>
</folderHeadline>
<folderHeadline>
<baseLanguage>en</baseLanguage>
<ipDocumentID>BLDW000020060831e28v0000g</ipDocumentID>
<accessionNo>BLDW000020060831e28v0000g</accessionNo>
<wordCount>222</wordCount>
<publicationDate>2006-08-31</publicationDate>
<sourceCode>bldw</sourceCode>
<sourceName>Blood Weekly</sourceName>
<headline>
<paragraph lang="en">Business Update; Hema-Quebec selects IDM Surround as its laboratory management system </paragraph>
</headline>
<snippet>
<paragraph>2006 AUG 31 - (NewsRx.com) -- Information Data Management, Inc., (IDM) announced that Hema-Quebec has selected IDM's Surround 4.2.1 System as their new centralized data collection and laboratory management system. </paragraph>
</snippet>
<copyright>(c) Copyright 2006 Blood Weekly via NewsRx.com </copyright>
<contentParts contentType="Article" primaryReference="distdoc:archive/ArchiveDoc::Article/BLDW000020060831e28v0000g">
<part type="NewsArticle" size="2091" reference="distdoc:archive/ArchiveDoc::Article/BLDW000020060831e28v0000g"></part>
</contentParts>
<editor>
<contentID>45665004</contentID>
<priority>None</priority>
</editor>
</folderHeadline>
</folderHeadlinesResultSet>
</folder>
</folderHeadlinesResult>
</folderHeadlinesResponse>
</GetFolderHeadlinesResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
(Sorry for the long codes but you couldn't understand what I meant when I didn't include these codes.
I couldn't reference the a hrefs in my XSL because I don't know how I can use an iterative loop in XSL.
Your attitude determines your altitude