hello all im working on an xml/xsl tool that displays post left by management
it uses an xsl style to transform the xml containing my entries into an xml that can be quickly read into to my .net tools. here is the original xml
and here is my xsl to generate the new xml I seem to be having problems adding the attachemnt node with the correct attributes.
if the attachment node is "none" then it will just place a bookmark to that entry
I appreciate any help or direction i can get with this thanks
DrewG
MCP, .Net Solutions Development <%_%>
it uses an xsl style to transform the xml containing my entries into an xml that can be quickly read into to my .net tools. here is the original xml
Code:
<data>
<supervisors>
<supentry
id="1"
author="Ray"
attachment="1"
relevance="general"
date="8-24-06"><![CDATA[This is a test entry]]></supentry>
<supentry
id="2"
author="Carl"
attachment="none"
relevance="general"
date="8-24-06"><![CDATA[This is a second test entry]]></supentry>
<supentry
id="3"
author="TheParrot"
attachment="2"
relevance="general"
date="8-24-06"><![CDATA[testing still]]></supentry>
<supentry
id="4"
author="joe"
attachment="none"
relevance="general"
date="8-24-06"><![CDATA[This is a not test entry]]></supentry>
<files>
<file name="A Form" id="1" filename="holymountains.txt" />
<file name="Another Form" id="2" filename="holyroller.txt" />
</files>
</supervisors>
<teamleads>
<tlentry
id="1"
author="Bob"
attachment="1"
relevance="specific"
date="8-24-06"><![CDATA[This is a test entry]]></tlentry>
<files>
<file name="Formage" id="1" filename="holymountains.txt" />
</files>
</teamleads>
</data>
and here is my xsl to generate the new xml I seem to be having problems adding the attachemnt node with the correct attributes.
if the attachment node is "none" then it will just place a bookmark to that entry
Code:
<xsl:stylesheet version="1.0"
xmlns:xsl="[URL unfurl="true"]http://www.w3.org/1999/XSL/Transform">[/URL]
<xsl:template match="/">
<data>
<xsl:for-each select="data/supervisors/supentry">
<entry>
<id><xsl:value-of select="@id"/></id>
<author>
<xsl:value-of select="@author"/>
</author>
<comments><xsl:value-of select="." disable-output-escaping="yes" /></comments>
<scope><xsl:value-of select="@relevance"/></scope>
<attachment><xsl:attribute name="url">
<xsl:call-template name="filename" />
</xsl:attribute>
<xsl:attribute name="text">
<xsl:call-template name="filetitle" />
</xsl:attribute>
</attachment>
</entry>
</xsl:for-each>
</data>
</xsl:template>
<!-- Filename Template displays attachemnt node with url and text attribute -->
<xsl:template name="filename" match="/data/supervisors/files//file">
<xsl:choose>
<xsl:when test="@id =..//supentry/@attachment" >
<xsl:if test="..//supentry/@attachment != 'none'">upload/<xsl:value-of select="..//file/@filename"/></xsl:if>
</xsl:when>
<xsl:otherwise>#SUP<xsl:value-of select="./@id"/></xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="filetitle" match="/data/supervisors/files//file">
<xsl:choose>
<xsl:when test="@id =..//supentry/@attachment" >
<xsl:if test="..//supentry/@attachment != 'none'">
<xsl:value-of select="..//file/@name"/>
</xsl:if>
</xsl:when>
<xsl:otherwise>None</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
I appreciate any help or direction i can get with this thanks
DrewG
MCP, .Net Solutions Development <%_%>