Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML nested tags problem

Status
Not open for further replies.

nizarhandal

Programmer
Aug 3, 2006
6
PS
I would like to export an html code from the attached XML file as follows:

-- Content Title

-- The first image
-- All the <p> tags between the first and the second media tag (or between the beginning of the <DataContent> tag and the second media tag)
-- The second image
-- All the <p> tags between the second and the third media tag
-- The third image
-- All the <p> tags between the third and the fourth media tag
-- The fourth image
-- All the <p> tags between the fourth <media> tag and the end of <DataContent> tag

Each media tag contain the image name that can be found with it's properties at the end of the xml file (I have no problem with loading the image to an image tag), but the following XSL code doesnt show the above required view.

The XML file
----------------
<?xml version="1.0" ?>
<NewsML>
<Catalog Href=" <NewsEnvelope>
<DateAndTime>20060603T083227Z</DateAndTime>
</NewsEnvelope>
<NewsItem>
<Identification>
<NewsIdentifier>
<ProviderId>afp.com</ProviderId>
<DateId>20060603</DateId>
<NewsItemId>060603083214.av12s4ic</NewsItemId>
<RevisionId PreviousRevision="0" Update="N">1</RevisionId>
<PublicIdentifier>urn:newsml:afp.com:20060603:060603083214.av12s4ic:1</PublicIdentifier>
</NewsIdentifier>
<NameLabel>???/???????</NameLabel>
</Identification>
<NewsManagement>
<NewsItemType FormalName="News"/>
<FirstCreated>20060603T083214Z</FirstCreated>
<ThisRevisionCreated>20060603T083214Z</ThisRevisionCreated>
<Status FormalName="Usable"/>
</NewsManagement>
<NewsComponent>
<NewsLines>
<HeadLine>??????? 2006: ???????? ???????? ??????? ??????? ?????? ???????? ???????</HeadLine>
<CopyrightLine>????? ????? ??? © 2006</CopyrightLine>
<SlugLine>???/??????? ?????</SlugLine>
</NewsLines>
<AdministrativeMetadata>
<Provider>
<Party FormalName="AFP"/>
</Provider>
</AdministrativeMetadata>
<DescriptiveMetadata>
<Language FormalName="ar"/>
<OfInterestTo FormalName="mmd--arabic--journal--sport"/>
</DescriptiveMetadata>
<NewsComponent>
<ContentItem>
<MediaType FormalName="Text"/>
<Format FormalName="bcNITF2.5"/>
<DataContent>
<media media-type="image" style="rightSide">
<media-reference mime-type="" data-location="#photo0" />
</media>
<p>??????? (? ? ?)- ???? ?????? ???????? ???????? ???? ???? ???? ?????? ???????? ??????? ??? ????? ?????? ?? ??????? ??????? 2006 ??? ???????? ???????? ????????? ????? ????? ???? ?? ??????? ????????? ???????.</p>

<p>???? ??????? ????????? ??? ??? ????? ?????? ???????? ???? ??? ?????? ?? ????? ?????? ?? ??????? ???????? ??? ?????? ????? ????? ??? "???????? ??????" ??? ?????? ?? ??????? ??? ?????? ???? ??????? ??? ??????? ??? ???? ??????? ??? ????.</p>
<p>???? ???????? ?????? ???????? ?? ????????? ??? ??? 1966 ????? ??? ????? ?????? ????? ?????? ??????? ?? ???? ?? ????? ????? ???? 1986 ?2002.</p>
<p>???? ???? ???????? ??? ??????? 2006 ??? ???? ????? ?? ?????? ????? ??? ???????? ?????? ???????? ??????? ??????????? ?????????? ??????? ????? ?????? ????? ????? ????? ?? ????????? ??? ?????? ?????? ?? ???????? ??????? ?? ??????? ?????? ???????.</p>
<p>???? ??????? ????????? ?????? ????????? ?????? ???? ?????? ??????? ???? ???? ?????? ??? ???? ????? ?? ?????? ????? ????? ??? ???? ?????? ?? ??? ?????? ???? ????????? ????? ???? ????? ?? ??? ????? ????????? 2004 ?? ???????? ??? ??? ????? ????? ???????? ???????? ??? ?? ?????? ???? ??????? ???-1.</p>
<p>?????? ??????? ??? ??? ?? ???? ?????? ????? ???? (???? ????? ????????) ?????? ??????? (????? ??? ????? ???????) ????? ????? (?????? ?????????) ????????? (?????? ????? ??????) ?????? ?? ?????? ????? ????? ?????? ??? ?????? ??????? ????? ????????? ??????? (??????? ??????? ?????????) ???????? ??????? (?????) ???????? (???????? ?????? ?????????) ???????? ??????? (????? ?????????) ???????? (??? ????? ???????) ??????.</p>
<p>????? ???????? ?????????? ???? ?????? ???? ???? ????? ??? ??????? ??? ????? ??? ??? ?????? ??? ?? ???? ????? ????? ?????? ???????? ????????? ???? ??? ?? ??????? ?? ??????? ?? ????????? ????? ??????? ?? ????? ??? ??? ??????? ????????? ?? ?????.</p>
<p>????? ??????? ????????? ???????? ???? ??? ???? ?????? ??????? ???? ?????? ?? ???? ??? ????? ???? ?? ???? ????? ????? ?? ???? ??? ??????? ????? ??? ????? ????? ????? ?????? ???? ????? ??????? ??? ????? ?? ?????? ????????? ??????? ?????? ????? ??? ????? ???? ????? ???? ??? ??????? ??????? ??? ?? ??????? ???????.</p>
<p>????? ??? ?????? ????? ???? ??????? ??? ???? ???? ?????? ?????? ?? ??????????? ?????? ??????? ??? ??? ?? ????? ?????? ??? ??????? ????? ?????? ????? ??? ??? ????? ???? ?? ????? ??????? ????? ????? ?????????? ??? ?? ????? ???? ??? ???? ????? ????????.</p>
<p>???? ???? ?? ???? ?? ????? ??????????? ???? ??? 2002 ?? ????? ???????? ???????? ??? ??? ??????? ?? ????? ????? ???????? ???? ???????? ??????? 2-3 ?????? ???????? ???-1 ???? ??? ?????? 4-??? ?? ???? ????? ??? ????? ????? ???? ?????? ??? ???? ?????? ????? ??? ?????? ?????? ???? ?????? ?? ??? ??? ?????????????.</p>
<p>?????? ??? ??????? ???? ?? ??? ?????? ????? ???? ?? ???? ?? ????? ?????? ??? ??????? ?? ?????? ????? ??????? ?? "???????? ??????" ??? ????? ??? ????? ????? ?? ??????????? ?????????.</p>
<p>???? ?? ????? ?????</p>
<media media-type="image" style="leftSide">
<media-reference mime-type="" data-location="#photo1" />
</media>
<p>????? ??????? ??? ???? ?? ?????? ??? ????? ????? ????? ???? ???? ???? ????? ????? ?????? ???????? ?? ??? ?????? ??????? 12 ??? ??? ????.</p>
<p>???? ???? ?????? ???? ????? ??? ????? ??????? ????? ??? ????? ?????? ???? ????? ??????? ???? ?????? ???????? ??? ??? ??? ??? ?? ??????? ?????? ??????? ????? 1994 ?? ???????? ??????? ???? ???? ??????? 1-3 ?????? ??????? ??? ???????? 1-1 ?? ??????? ?????? ???????? ?1998 ?? ????? ???? ???? ??????? 1-2 ?2002 ?? ????? ???????? ???? ???? ???????? ??????? ???-2.</p>
<p>????? ??? ??????? ???????? ?? ??????? ??? ?????? ??? ????? ????? ??? ??????? ????? ??? ???? ??? 1970 ??? ??? ???? ??????? 1-4 ?1986 ??? ?? ???? ???? ??????? ?????? ??????? 1-4.</p>
<p>??? ????????? ?????? ????? ????? 30 ?50 ?54 ?58 ?62 ?66 ?1978 ???? ???? ?? ????? ?????.</p>
<p>?? ???? ??????? ?? ????? ?? ????????? ?? ?????? ???? ?????? ?? ????? ??? ????? ??? ?? ????? ????? ????? 2-1.</p>
<p>???? ??????? ???????? ???????? ???? ?????? ?????? ?????????? ??????? ??????? ??? ????? ????? ????? ?? ??????? 1978 ????? ??? ????? ????? ???? ??????? ??? 2002 ???? ??? ???? ?? ??? ???? ?????? ??????? ?????? ??????? ????? ?????? ????????? ??????? ??????? ??? ??????? ???????.</p>
<p>?? ??? ???? ??????? ?? ??????? ???????? ?????? ??????? ?? ???? ?????????? ????? ????? ?? ??? ????? ???? ??? ??? ????? ????? ????? ??? ?????? ????? ?? ???????? ??????? ???? ???? ?? ??????? ???????? ????? ???? ??? ????? ?? ?????? ??????? ?? ?????????.</p>
<p>????? ??? ????? ??????? ??? ?????? ????? ?????? ????????? ??????? ??????? ???? ????? ?????? ???? ?? ????? ?????? ??????? ?? ???? ???? ????? ???? ????? ??? ???? ??? ??? ??? ???????? ????? ?????? ???????? ???? ????? ????? ???? ????????? ??? ??? ???? ??? ????????? ????? ???? ??????? ?????? ???????? ????? ?? ????????.</p>
<p>??? ???? ????? ??????? ?? ????????? ????? ?????? ????????? ????? ??????? (32 ????) ???? ???????? ????? 14 ???? ????? ????? ??? ???? 37 ???? ????? ?? 71 ?????? ???? ?? ??????? ????? ????????? ??????? (26 ????) ???? ???? ???? ?????? ???? ??? ???? ????? ???? ?? ????????.</p>
<p>???? ???????? ????????? "??????" ??????? ?????? ?????? ?? ????? 37 ???? ????? ???? ?????? ?????? ?? ??? ???? ????? ??????? ???? ????????? ?????? ??? ???? ?? ????? 176 ?????? ?? ????? ????? ??? ???? ???? ??? ?????? ??????? ???? ?????? ???? ????? ??????? ????? 181 ??????.</p>
<p>????? ??????? ???? ??? ?????? ?????? ??? ??????? ?????????? ????? ?????? ?????? ??????? ?? ??????? ???????? ????? ????? ????????? ????? ??????? ?????? ???????? ???? ?????? ?????? (27 ????) ???? ??? ?? ??????? ???? ??? ?????? ????????.</p>
<p>???? ?? ??????? ???? ??? ??? ????? ????? ????? ?????? ????? ???? ????? ?????? ???? ?????? ?????? ?????? ???????? ?????? ????? ???????? ??????.</p>
<p>?????? ????? ??????</p>
<media media-type="image" style="rightSide">
<media-reference mime-type="" data-location="#photo2" />
</media>
<p>???? ?? ???? ????? ????? ?????? ?? ???? ??????? ??? ???? ???? ??? ???? ??? ???? ??????? ???? ??????? ??????? ????????? ?? ??? ????? ????? ????? ????? ????? ?? ??????? ??????? ???????.</p>

<p>???? ??? ??????? ???????? ????? ?? ??? ?????? ????? ??????? ??? ???? 1978 ?1998 ????? ????? ???????? ??????? ????? ???? ??? ??????? ????????? ?? ????? ?????? ?? ???? ????????.</p>
<p>??? ???? ????? ????? ????? ?? ????????? ??? ??????? ????????? ??? 1978 ???? ???? ?????? ???-3 ????? ?????? 1-4 ??????? ?? ???????? 1-1 ??? ???????? ??????? ?? ??????? ????? ??? 1998 ??? ????? ?????? ?? ??? ?????? ??????? ??? ???? ???? ??? ???? ???????? ??????? 2-1 ????? ???? ?? ????????? ???????? ???? ?????????? (?????) ???-1 ???????? ???-2.</p>
<p>????? ??????? ???????? ??????? ???? ?? ?????? ???????? ??? ???? ???? ??? ???? ?????? ?????? ??? ??????? ??? ?????? ??? ?? ??????? ???? ???? ????? ?? ?????? ????? ??? ??? ??? ????? ???????? ???? ??? ?? ????? ???? ???? ?? ?????????.</p>
<p>??? ????? ????? ?? ???????? ??????? ??? ??????? ??????? ???? ????? ??? ??? 3-1 ?3-2 ???? ???? ?????? ????? 7-??? ????? ?????? ????? ???? ?????? ???-1 ?? ???? ????? 2-???.</p>
<p>??? ????? ?????? ?? ??? ?????? ????? ?? ?????? ???? ??? ???? ??????? ???????? ?????? ???????? ??????? ?? ??????? ???-??? ????? ????? 1-??? ????? ??? ??????? 2-1 ????? ?????? 1-2 ??? ?? ???? ???? ?????? ????? ??? ????? ???????? 2-??? ?1-??? ???? ????? ?? ???????? ??? ???????.</p>
<p>??? ???? ????? ??????? ???????? ?? ????????? ?? ???? ?? ??? ?? ?? ?????? ??????? ????? ?? ??????? ????????? ???? ????? ?? ???? ?????? ?????? ???????? ?????????? ???? ???? ???? ???? ??? ??????? ???????? ?????? ?????? ????? ????? ???? ????? ???? ????? ???? ?????? ?????? ??? ????? ?????? ????? ?????? ?? ??????? ????? ??????? ?? ?????? ????? ????????? ?? ????? ??????.</p>
<p>????? ?? ????? ????????? ????? ???????? ?????????? ?? ?????? ?? ??????? ????????? ???????? ??? ???? ??? ??????? ?????????? ????? ???? ??????? ?????? ??????? ???????.</p>
<p>?????? ??????? ??????? ??????? ??????? ????? ???? ??????? ??? ???? ???? ????? ????????? ?????? ????? ????? ???? ??? ?? ???? ????? ???????? ?????? ??? ?????? ??? ??????? ???????? ?? ???????.</p>
<p>??? 2002 ???? ??????? ????? ?????? ????? ?????? ?? ??????? ?????? ???????? ??? ??????? ?? ???? ????? ????? ??? ????.</p>
<p>???? ??????? ???????? ?????? ???????? ?????? ??????????? ??? ??? ???? ????? ?? ?? ????????? ????? ????? ?? ??????? ???????? ?? ????? ??? ????? ?????? ???? ????? ??? ????? ?????? ??????? ???? ?? ?????? ????? ???????? ?????? ?????? ???? ????? ?????? ??? ???? ????? ?????? ??????? ??? ????? ?????? ????? ??????.</p>
<p>????? ??????? ???????? ?? ????? ??? ????? ?????? ?? ????????? ?? ?????? ??? ????? ????? ??????? ?? ???? ?? ???? ?? ????????? ???????? ????? ????? ???? ????? ?????? ???? ???? ???? ?????? ??????? ????????? ??? ?????? ???????? ?? ?? ???? ?????? ????? ?? ?????? ??????? ???? ????? ??????????? ????????? ???? ???? ?? ???? ????????? ?????? ???????.</p>
<p>???? ??? ???????</p>
<media media-type="image" style="leftSide">
<media-reference mime-type="" data-location="#photo3" />
</media>
<p>????? ?????? ?????? ?? ????????? ????????? ????? ??????? ??? ??????? ??? ?????? ????? ?????? ?? ??????? ??? ????? ???? ???? ??????? ????? ????? ???? ????? ????? ??????? ?? ????????? ???? ?????? ?????? ????? ?? ????? ????? ??????? ?????? ????????? ??????? ?????? ?? ????????.</p>

<p>???? ???? ?????? ??????? ?? ???????? ????????? ??? ??????? ????????? ???????? ??????? ???????? ?????.</p>
<p>??? ??????? ???????? ???? ?? ?????? ????????? ?? ?????? ??????? (???????? ?????????) ?????? ???? (???????? ?????????) ????? (????? ?????????) ?????? ????? (??????? ?????????).</p>
</DataContent>
</ContentItem>
</NewsComponent>
<NewsComponent Duid="photo0">
<NewsLines>
<HeadLine>????? ??????? ????????? ???? ?????? ???? ?? ????????? </HeadLine>
</NewsLines>
<AdministrativeMetadata>
<Provider>
<Party FormalName="????? ?? ? "/>
</Provider>
<Creator>
<Party FormalName="??? ??????? ???????"/>
</Creator>
</AdministrativeMetadata>
<NewsComponent>
<Role FormalName="Caption"/>
<ContentItem>
<MediaType FormalName="Text"/>
<Format FormalName="bcNITF2.5"/>
<DataContent>
<p>???? ??????? ????????? ??? ??? ????? ?????? ???????? ???? ??? ?????? ?? ????? ?????? ?? ??????? ???????? ??? ?????? ????? ????? ??? "???????? ??????"? ??? ?????? ?? ??????? ??? ?????? ???? ??????? ??? ??????? ??? ???? ??????? ??? ????.</p>
</DataContent>
</ContentItem>
</NewsComponent>
<NewsComponent>
<Role FormalName="Thumbnail"/>
<ContentItem Href="SGE.CYE81.030606083150.photo00.thumbnail.default-110x75.jpg">
<MediaType FormalName="Photo"/>
<Characteristics>
<Property FormalName="Width" Value="110"/>
<Property FormalName="Height" Value="75"/>
</Characteristics>
</ContentItem>
</NewsComponent>
<NewsComponent>
<Role FormalName="Quicklook"/>
<ContentItem Href="SGE.CYE81.030606083150.photo00.quicklook.default-245x169.jpg">
<MediaType FormalName="Photo"/>
<Characteristics>
<Property FormalName="Width" Value="245"/>
<Property FormalName="Height" Value="169"/>
</Characteristics>
</ContentItem>
</NewsComponent>
<NewsComponent>
<Role FormalName="Preview"/>
<ContentItem Href="SGE.CYE81.030606083150.photo00.photo.default-512x354.jpg">
<MediaType FormalName="Photo"/>
<Characteristics>
<Property FormalName="Width" Value="512"/>
<Property FormalName="Height" Value="354"/>
</Characteristics>
</ContentItem>
</NewsComponent>
</NewsComponent>
<NewsComponent Duid="photo1">
<NewsLines>
<HeadLine>??????? ???????? ??????? ?? ??????? 2006</HeadLine>
</NewsLines>
<AdministrativeMetadata>
<Provider>
<Party FormalName="????? ?? ? "/>
</Provider>
<Creator>
<Party FormalName="??? ????? "/>
</Creator>
</AdministrativeMetadata>
<NewsComponent>
<Role FormalName="Caption"/>
<ContentItem>
<MediaType FormalName="Text"/>
<Format FormalName="bcNITF2.5"/>
<DataContent>
<p>????? ??????? ??? ???? ?? ?????? ??? ????? ????? ????? ???? ???? ???? ????? ????? ?????? ???????? ?? ??? ?????? ??????? 12 ??? ??? ????. </p>
</DataContent>
</ContentItem>
</NewsComponent>
<NewsComponent>
<Role FormalName="Thumbnail"/>
<ContentItem Href="SGE.CYE81.030606083150.photo01.thumbnail.default-110x69.jpg">
<MediaType FormalName="Photo"/>
<Characteristics>
<Property FormalName="Width" Value="110"/>
<Property FormalName="Height" Value="69"/>
</Characteristics>
</ContentItem>
</NewsComponent>
<NewsComponent>
<Role FormalName="Quicklook"/>
<ContentItem Href="SGE.CYE81.030606083150.photo01.quicklook.default-245x154.jpg">
<MediaType FormalName="Photo"/>
<Characteristics>
<Property FormalName="Width" Value="245"/>
<Property FormalName="Height" Value="154"/>
</Characteristics>
</ContentItem>
</NewsComponent>
<NewsComponent>
<Role FormalName="Preview"/>
<ContentItem Href="SGE.CYE81.030606083150.photo01.photo.default-512x323.jpg">
<MediaType FormalName="Photo"/>
<Characteristics>
<Property FormalName="Width" Value="512"/>
<Property FormalName="Height" Value="323"/>
</Characteristics>
</ContentItem>
</NewsComponent>
</NewsComponent>
<NewsComponent Duid="photo2">
<NewsLines>
<HeadLine>??? ???? ????? ??????? ????????</HeadLine>
</NewsLines>
<AdministrativeMetadata>
<Provider>
<Party FormalName="????? ?? ? "/>
</Provider>
<Creator>
<Party FormalName="????? ???? "/>
</Creator>
</AdministrativeMetadata>
<NewsComponent>
<Role FormalName="Caption"/>
<ContentItem>
<MediaType FormalName="Text"/>
<Format FormalName="bcNITF2.5"/>
<DataContent>
<p>???? ?? ???? ????? ????? ?????? ?? ???? ??????? ??? ???? ???? ??? ???? ??? ???? ??????? ???? ??????? ??????? ????????? ?? ??? ????? ????? ????? ????? ????? ?? ??????? ??????? ???????.</p>
</DataContent>
</ContentItem>
</NewsComponent>
<NewsComponent>
<Role FormalName="Thumbnail"/>
<ContentItem Href="SGE.CYE81.030606083150.photo02.thumbnail.default-67x100.jpg">
<MediaType FormalName="Photo"/>
<Characteristics>
<Property FormalName="Width" Value="67"/>
<Property FormalName="Height" Value="100"/>
</Characteristics>
</ContentItem>
</NewsComponent>
<NewsComponent>
<Role FormalName="Quicklook"/>
<ContentItem Href="SGE.CYE81.030606083150.photo02.quicklook.default-166x245.jpg">
<MediaType FormalName="Photo"/>
<Characteristics>
<Property FormalName="Width" Value="166"/>
<Property FormalName="Height" Value="245"/>
</Characteristics>
</ContentItem>
</NewsComponent>
<NewsComponent>
<Role FormalName="Preview"/>
<ContentItem Href="SGE.CYE81.030606083150.photo02.photo.default-348x512.jpg">
<MediaType FormalName="Photo"/>
<Characteristics>
<Property FormalName="Width" Value="348"/>
<Property FormalName="Height" Value="512"/>
</Characteristics>
</ContentItem>
</NewsComponent>
</NewsComponent>
<NewsComponent Duid="photo3">
<NewsLines>
<HeadLine>????? ?????? ???? ?????? ???? ???? ?????</HeadLine>
</NewsLines>
<AdministrativeMetadata>
<Provider>
<Party FormalName="????? ?? ? "/>
</Provider>
<Creator>
<Party FormalName="????? ??????????"/>
</Creator>
</AdministrativeMetadata>
<NewsComponent>
<Role FormalName="Caption"/>
<ContentItem>
<MediaType FormalName="Text"/>
<Format FormalName="bcNITF2.5"/>
<DataContent>
<p>???? ?????? ?????? ?? ????????? ????????? ????? ??????? ??? ??????? ??? ?????? ????? ?????? ?? ??????? ??? ????? ???? ???? ??????? ????? ????? ???? ????? ????? ??????? ?? ????????? ???? ?????? ?????? ????? ?? ????? ????? ??????? ?????? ????????? ??????? ?????? ?? ????????.</p>
</DataContent>
</ContentItem>
</NewsComponent>
<NewsComponent>
<Role FormalName="Thumbnail"/>
<ContentItem Href="SGE.CYE81.030606083150.photo03.thumbnail.default-110x74.jpg">
<MediaType FormalName="Photo"/>
<Characteristics>
<Property FormalName="Width" Value="110"/>
<Property FormalName="Height" Value="74"/>
</Characteristics>
</ContentItem>
</NewsComponent>
<NewsComponent>
<Role FormalName="Quicklook"/>
<ContentItem Href="SGE.CYE81.030606083150.photo03.quicklook.default-245x167.jpg">
<MediaType FormalName="Photo"/>
<Characteristics>
<Property FormalName="Width" Value="245"/>
<Property FormalName="Height" Value="167"/>
</Characteristics>
</ContentItem>
</NewsComponent>
<NewsComponent>
<Role FormalName="Preview"/>
<ContentItem Href="SGE.CYE81.030606083150.photo03.photo.default-512x349.jpg">
<MediaType FormalName="Photo"/>
<Characteristics>
<Property FormalName="Width" Value="512"/>
<Property FormalName="Height" Value="349"/>
</Characteristics>
</ContentItem>
</NewsComponent>
</NewsComponent>
</NewsComponent>
</NewsItem>
</NewsML>



The XSL file
-------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl=" xmlns:fo=" <xsl:eek:utput method="html"/>
<xsl:template match="/">
<html>
<head>
<title>
<xsl:value-of select="NewsML/NewsItem/NewsComponent/NewsLines/HeadLine"/>
</title>
</head>
<body dir="rtl">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2">
<div align="center">
<strong>
<xsl:value-of select="NewsML/NewsItem/NewsComponent/NewsLines/HeadLine"/>
</strong>
</div>
</td>
</tr>
<tr>
<td width="70%">
<div align="justify">
<xsl:for-each select="NewsML/NewsItem/NewsComponent/NewsComponent/ContentItem/DataContent">
<xsl:value-of select="media/media-reference/@data-location"/>
<xsl:copy-of select="p"/>
</xsl:for-each>
</div>
</td>
</tr>
<tr>
<td colspan="2">
<div align="center">
<input name="Button3" type="button" onClick="javascript: history.go(-1);" value="&#1585;&#1580;&#1608;&#1593;"/>
</div>
</td>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

Thanks in advance
 
It looks like you want to do something like this:
Code:
<xsl:for-each select="NewsML/NewsItem/NewsComponent/NewsComponent/ContentItem/DataContent/*">
    <xsl:choose>
    <xsl:when test="local-name()='media'>
        [i]process the media node here[/i]
    </xsl:when>
    <xsl:when test='local-name()='p'>
        <xsl:copy-of select="."/>
    </xsl:when>
    <xsl:otherwise>
        [i]process a child node that is not 'p' or 'media' here[/i]
    </xsl:otherwise>
</xsl:for-each>


Tom Morrison
 
Here is a simplified example stylesheet (output changed to text for illustration purposes);
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="[URL unfurl="true"]http://www.w3.org/1999/XSL/Transform"[/URL] xmlns:fo="[URL unfurl="true"]http://www.w3.org/1999/XSL/Format">[/URL]
    <xsl:output method="text"/>
    <xsl:template match="/">
        <xsl:for-each select="NewsML/NewsItem/NewsComponent/NewsComponent/ContentItem/DataContent/*">
		    <xsl:choose>
			<xsl:when test="local-name(.)='media'">
				<xsl:text>Media: </xsl:text><xsl:value-of select="media-reference/@data-location"/><xsl:text>
</xsl:text>
			</xsl:when>
			<xsl:when test="local-name(.)='p'">
				<xsl:text>...P starting with: </xsl:text><xsl:value-of select="substring(.,1,25)"/><xsl:text>
</xsl:text>
			</xsl:when>
		</xsl:choose>
        </xsl:for-each>
    </xsl:template>
</xsl:stylesheet>
When run against your sample XML document, It returns:
Code:
Media: #photo0
...P starting with: ??????? (? ? ?)- ???? ???
...P starting with: ???? ??????? ????????? ??
...P starting with: ???? ???????? ?????? ????
...P starting with: ???? ???? ???????? ??? ??
...P starting with: ???? ??????? ????????? ??
...P starting with: ?????? ??????? ??? ??? ??
...P starting with: ????? ???????? ??????????
...P starting with: ????? ??????? ????????? ?
...P starting with: ????? ??? ?????? ????? ??
...P starting with: ???? ???? ?? ???? ?? ????
...P starting with: ?????? ??? ??????? ???? ?
...P starting with: ???? ?? ????? ?????
Media: #photo1
...P starting with: ????? ??????? ??? ???? ??
...P starting with: ???? ???? ?????? ???? ???
...P starting with: ????? ??? ??????? ???????
...P starting with: ??? ????????? ?????? ????
...P starting with: ?? ???? ??????? ?? ????? 
...P starting with: ???? ??????? ???????? ???
...P starting with: ?? ??? ???? ??????? ?? ??
...P starting with: ????? ??? ????? ??????? ?
...P starting with: ??? ???? ????? ??????? ??
...P starting with: ???? ???????? ????????? "
...P starting with: ????? ??????? ???? ??? ??
...P starting with: ???? ?? ??????? ???? ??? 
...P starting with: ?????? ????? ??????
Media: #photo2
...P starting with: ???? ?? ???? ????? ????? 
...P starting with: ???? ??? ??????? ????????
...P starting with: ??? ???? ????? ????? ????
...P starting with: ????? ??????? ???????? ??
...P starting with: ??? ????? ????? ?? ??????
...P starting with: ??? ????? ?????? ?? ??? ?
...P starting with: ??? ???? ????? ??????? ??
...P starting with: ????? ?? ????? ????????? 
...P starting with: ?????? ??????? ??????? ??
...P starting with: ??? 2002 ???? ??????? ???
...P starting with: ???? ??????? ???????? ???
...P starting with: ????? ??????? ???????? ??
...P starting with: ???? ??? ???????
Media: #photo3
...P starting with: ????? ?????? ?????? ?? ??
...P starting with: ???? ???? ?????? ??????? 
...P starting with: ??? ??????? ???????? ????

Tom Morrison
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top