Hello Expert,
URGENT!!!!
This query is related to existing accepted query...
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/XSLT/Q_22666065.htmlIn my xml there is an attribute @name which contains file path...i have to split it into two columns as file name and file path...here is the xsl code from which i am getting file name as given by you...
So the output html contains filepath as one column and filename as another column...in <table id="tbl"
XSL CODE...
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="
http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output indent="yes" method="html"/>
<xsl:template match="/">
<html>
<head/>
<xsl:element name="link">
<xsl:attribute name="rel">stylesheet</xsl
:attribute
>
<xsl:attribute name="type">text/css</xsl:
attribute>
<xsl:attribute name="href">global.css</xs
l:attribut
e>
</xsl:element>
<xsl:element name="link">
<xsl:attribute name="rel">stylesheet</xsl
:attribute
>
<xsl:attribute name="type">text/css</xsl:
attribute>
<xsl:attribute name="href">netscape6.css<
/xsl:attri
bute>
</xsl:element>
<xsl:element name="script">
<xsl:attribute name="language">javascript
</xsl:attr
ibute>
<xsl:attribute name="src">tablefilter.js<
/xsl:attri
bute>
</xsl:element>
<body onLoad="attachFilter(docum
ent.getEle
mentById('
tbl'), 1)">
<h2>Missing Art Report</h2>
<table width="600" border="0" cellpadding="2" bordercolor="#333333" bgcolor="#CCCCCC" style="font-family: verdana;">
<tbody>
<tr bgcolor="#ffcc66">
<th colspan="2" bgcolor="#FFFFFF" style="border-right: 1px solid silver; cursor: default; color: white; background-color: #336699;">
<div align="left">Summary</div>
</th>
</tr>
<tr>
<td width="216" bgcolor="#FFFFFF">Componen
t</td>
<td width="289" bgcolor="#FFFFFF">
<xsl:value-of select="//component"/>
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF">Language
</td>
<td bgcolor="#FFFFFF">
<xsl:value-of select="//language"/>
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF">Missing Art Count </td>
<td bgcolor="#FFFFFF">
<xsl:value-of select="//missingartcount"
/>
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF">Total Art Count </td>
<td bgcolor="#FFFFFF">
<xsl:value-of select="//totalartcount"/>
</td>
</tr>
</tbody>
</table>
<br/>
<xsl:apply-templates select="artreport"/>
</body>
</html>
</xsl:template>
<xsl:template match="artreport">
<table id="tbl" style="border: 1px solid silver; border-collapse: collapse;" cellspacing="0" width="60%">
<tbody>
<tr>
<th width="50%" bgcolor="#FFFFFF" style="border-right: 1px solid silver; cursor: default; color: white; background-color: #336699;">File path</th>
<th width="50%" bgcolor="#FFFFFF" style="border-right: 1px solid silver; cursor: default; color: white; background-color: #336699;">File Name</th>
<th bgcolor="#FFFFFF" style="border-right: 1px solid silver; cursor: default; color: white; background-color: #336699;">Missing Status</th>
</tr>
<xsl:apply-templates select="artfile"/>
</tbody>
</table>
</xsl:template>
<xsl:template match="artfile">
<tr>
<td style="border: 1px solid silver; cursor: default;">
<xsl:call-template name="getFileName">
<xsl:with-param name="str" select="@name"/>
</xsl:call-template>
</td>
<xsl:for-each select="*">
<xsl:choose>
<xsl:when test="*[text()!='']">
<td/>
</xsl:when>
<xsl:otherwise>
<td style="border: 1px solid silver; cursor: default;">
<xsl:value-of select="."/>
</td>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</tr>
</xsl:template>
<xsl:template name="getFileName">
<xsl:param name="str"/>
<xsl:choose>
<xsl:when test="contains($str, '/')">
<xsl:call-template name="getFileName">
<xsl:with-param name="str" select="substring-after($s
tr, '/')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$str"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
XML...
<artreport>
<summary>
<component>Cannon-CUG</com
ponent>
<language>German</language
>
<missingartcount>3</missin
gartcount>
<totalartcount>3</totalart
count>
</summary>
<artfile name="/AIS/Adobe/testing/t
est0.png">
<artstatus>found</artstatu
s>
</artfile>
<artfile name="/AIS/Adobe/testing/t
est1.png">
<artstatus>missing</artsta
tus>
</artfile>
Start Free Trial