XSL/XML Issue - Attribute and namespace issue



I am using ThumbGen to generate Movie Sheets. For my digital movies. It uses XSL. and my idea was to have it take the 'actors' and load the picture up from a folder with their pics in it. I searched online, and someone else had a question on how to fix an issue doing the exact same thing. So I used that as a basis, but was unable to get it to work.


I'm getting the error: "Attribute and namespace nodes cannot be added to the parent element after a text, comment, pi, or sub-element node has already been added."


In my trying to get this to work I found this:


http://ift.tt/1ERlSPI


And using that, his 'fix' that was told to him, is giving me the error he was having before the fix, I've been working on it for the past week. but I've never even heard of XSL before this. Can anyone see maybe what's wrong with it?


But here is the Line in the XML File:



<ImageElement Name="Actor1" X="980" Y="44" Width="93" Height="123" Source="File" Offset="0" MultiPageIndex="-1" SourceData="" NullImageUrl="%PATH%\..\Common\cast\NoPhotoAvailable.jpg" />


And My XSL file is:



<xsl:stylesheet version="1.0" xmlns:xsl="http://ift.tt/tCZ8VR">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:variable name="pathvalue" select="//tokens/token[@name='%PATH%']"/>
<xsl:variable name="folderactors" select="string('\..\Common\cast\')"/>
<xsl:variable name="actorsext" select="string('.jpg')"/>
<xsl:variable name="actorstext" select="string('')"/>
<xsl:variable name="lista1" select="//tokens/token[@name='%ACTORS%']"/>
<xsl:variable name="actor1" select="substring-before($lista1, ',')" />
<xsl:variable name="resto1" select="substring-after($lista1, ',')" />
<xsl:variable name="lista2" select="$resto1"/>
<xsl:variable name="actor2" select="substring-before($lista2, ',')" />
<xsl:template match="ImageElement[@Name='Actor1']">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:choose>
<xsl:when test="$actor1 != '' ">
<xsl:attribute name="SourceData">
<xsl:value-of select="concat($pathvalue,$folderactors,$actor1,$actorsext)"/>
</xsl:attribute>
</xsl:when>
</xsl:choose>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>


Thank You. -Dev


No comments:

Post a Comment