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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Output full result string from xpath query

Status
Not open for further replies.

Jimbo2112

IS-IT--Management
Mar 18, 2002
109
GB
Hi All,

I am using XML Spy on PC and I have a manipulation issue. I have a requirement to output more than I currently get from the xpath query below:

//illustration/image[@src=""]

from this XML:

<illustration id="CHOWIN104STYPRO_002">
<image src=""/>
<caption>
<head>Stainless steel for a light touch</head>
<p>Like many light, crisp whites, wines that are aromatic and juicy are vinified at low temperatures to bring out their fruitiness, usually in stainless steel vats to maintain the wine’s freshness.</p>
</caption>
</illustration>

the result will be:

<image src=""/>

What I want is to get:

<illustration id="CHOWIN104STYPRO_002"><image src=""/>

What is the xpath query that will give me this result, or am I hamstrung with XML Spy functionality?

Cheers

Jimbo
 
In terms of xsl, it is something like this.
[tt]
<xsl:template match="/">
<xsl:apply-templates select="//illustration[red][image/@src=''][/red]" mode="special"/>
</xsl:template>
<xsl:template match="illustration" mode="special">
<xsl:copy>
<xsl:apply-templates select="@*" />
<xsl:copy-of select="image" />
</xsl:copy>
</xsl:template>
<xsl:template match="@*">
<xsl:copy-of select="." />
</xsl:template>
[/tt]
As to in xmlspy ide, you've to adapt to it.
 
Excellent! Top result!

Thanks

I just need to enrole on a XSLT course ...

Jimbo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top