EDN Admin
Well-known member
I have very little knowledge of xml or xsl sheets. I have been experimenting with a program called Thumbgen to generate movie graphics with pictures of actors. The movie data is scraped by Thumbgen and can then be manipulated by a style sheet and/or
an xml document. This first section is a bit of the style sheet where actors names areextracted from a string of names separated by "/" symbols<br/>
<br/>
<br/>
<xsl:variable name="actorsext" select="string(.jpg)"/><br/>
<xsl:variable name="actorstext" select="string()"/><br/>
<xsl:variable name="lista1" select="//tokens/token[@name=%ACTORS%]"/>
<br/>
<xsl:variable name="actor1" select="substring-before($lista1, /)" /> <br/>
<xsl:variable name="resto1" select="substring-after($lista1, /)" /><br/>
<xsl:variable name="lista2" select="$resto1"/> <br/>
<xsl:variable name="actor2" select="substring-before($lista2, /)" /> <br/>
<br/>
This second bit is further down the style sheet where the actor image related to the actor name is found in a folder full of jpgs<br/>
<br/>
<br/>
<br/>
<xsl:template match="ImageElement[@Name=Actor1] <br/>
<xsl:copy><br/>
<xsl:apply-templates select="@*|node()"/><br/>
<xsl:choose><br/>
<xsl:when test="$actor1 != <br/>
<xsl:attribute name="SourceData <xsl:value-of select="concat($pathvalue,$folderactors,$actor1,$actorsext)"/></xsl:attribute><br/>
</xsl:when><br/>
</xsl:choose><br/>
</xsl:copy><br/>
</xsl:template><br/>
<br/>
<br/>
This is a small bit of the xml sheet where the actor jpg is placed in a larger jpg (1280 x 720)<br/>
<br/>
<br/>
<ImageElement Name="Actor1" X="980" Y="44" Width="93" Height="123" Source="File" Offset="0" MultiPageIndex="-1" SourceData="" NullImageUrl="%PATH%..CommoncastNoPhotoAvailable.jpg <br/>
<br/>
<Actions><br/>
<Rotate Angle="3" InterpolationMode="HighQualityBicubic" /><br/>
</Actions><br/>
<br/>
Everything works fine except if I add the last bit - the rotate angle action. When I do that it produces an error message:
<br/>
"Attribute and namespace nodes cannot be added to the parent element after a text, comment, pi, or sub-element node has already been added." Is there any way around this problem?
View the full article
an xml document. This first section is a bit of the style sheet where actors names areextracted from a string of names separated by "/" symbols<br/>
<br/>
<br/>
<xsl:variable name="actorsext" select="string(.jpg)"/><br/>
<xsl:variable name="actorstext" select="string()"/><br/>
<xsl:variable name="lista1" select="//tokens/token[@name=%ACTORS%]"/>
<br/>
<xsl:variable name="actor1" select="substring-before($lista1, /)" /> <br/>
<xsl:variable name="resto1" select="substring-after($lista1, /)" /><br/>
<xsl:variable name="lista2" select="$resto1"/> <br/>
<xsl:variable name="actor2" select="substring-before($lista2, /)" /> <br/>
<br/>
This second bit is further down the style sheet where the actor image related to the actor name is found in a folder full of jpgs<br/>
<br/>
<br/>
<br/>
<xsl:template match="ImageElement[@Name=Actor1] <br/>
<xsl:copy><br/>
<xsl:apply-templates select="@*|node()"/><br/>
<xsl:choose><br/>
<xsl:when test="$actor1 != <br/>
<xsl:attribute name="SourceData <xsl:value-of select="concat($pathvalue,$folderactors,$actor1,$actorsext)"/></xsl:attribute><br/>
</xsl:when><br/>
</xsl:choose><br/>
</xsl:copy><br/>
</xsl:template><br/>
<br/>
<br/>
This is a small bit of the xml sheet where the actor jpg is placed in a larger jpg (1280 x 720)<br/>
<br/>
<br/>
<ImageElement Name="Actor1" X="980" Y="44" Width="93" Height="123" Source="File" Offset="0" MultiPageIndex="-1" SourceData="" NullImageUrl="%PATH%..CommoncastNoPhotoAvailable.jpg <br/>
<br/>
<Actions><br/>
<Rotate Angle="3" InterpolationMode="HighQualityBicubic" /><br/>
</Actions><br/>
<br/>
Everything works fine except if I add the last bit - the rotate angle action. When I do that it produces an error message:
<br/>
"Attribute and namespace nodes cannot be added to the parent element after a text, comment, pi, or sub-element node has already been added." Is there any way around this problem?
View the full article