Sign up here and you can log into the forum!

XSL Support for templates

Support forum for the great ThumbGen software

Re: XSL Support for templates   

Postby ozzii » Wed Dec 01, 2010 1:09 am

I use this for having the time in hour,minutes
Code: Select all
   <xsl:template match="TextElement[@Name='Runtime']">
        <xsl:variable name="hours" select="floor($Runtime div 60)"/>
        <xsl:variable name="minutes" select="$Runtime mod 60"/>
        <xsl:copy>
         <xsl:apply-templates select="@*|node()"/>
         <xsl:choose>
             <xsl:when test="$Runtime != '' ">
                    <xsl:attribute name="Text"><xsl:value-of select="concat($hours,'h','',$minutes)"/></xsl:attribute>
                </xsl:when>
         </xsl:choose>
      </xsl:copy>
   </xsl:template>

I saw this:
Image

Can someone told me what I have to change for having a zero before the minutes if it's under 10.
So I would like to have 2H00 to 2H09.
Thanks.
ozzii
DLX'er
 
Posts: 143
Joined: Mon Apr 26, 2010 5:09 am

Re: XSL Support for templates   

Postby Buhric » Wed Dec 01, 2010 3:40 am

try this
not sure of the exact syntaxt... dont have time to test it properly
Code: Select all
   <xsl:template match="TextElement[@Name='Runtime']">
     <xsl:variable name="hours" select="floor($Runtime div 60)"/>
     <xsl:variable name="minutes" select="$Runtime mod 60"/>
     <xsl:copy>
       <xsl:apply-templates select="@*|node()"/>
       <xsl:if test="($Runtime != '') and ($minutes &lt; 10)">
         <xsl:attribute name="Text"><xsl:value-of select="concat($hours,'h','0',$minutes)"/></xsl:attribute>
       </xsl:if>
       <xsl:if test="($Runtime != '') and ($minutes >= 10)">
         <xsl:attribute name="Text"><xsl:value-of select="concat($hours,'h','',$minutes)"/></xsl:attribute>
       </xsl:if>
     </xsl:copy>
   </xsl:template>
and you should already have a the $runtime variable defined somewhere...

EDIT: I tested the code and made some modifications.... it will work now
But just a note here.... the token Runtime is not always populated... so you might have some instances where its empty, and define a default value...
or you might want to go with token DURATIONSEC, which is the actual movie time in seconds...
Buhric
Global Moderator
 
Posts: 616
Joined: Thu Apr 15, 2010 2:49 pm

Re: XSL Support for templates   

Postby ozzii » Wed Dec 01, 2010 9:45 am

Thanks Buhric (always a good help).
I will test this as soon as home.
ozzii
DLX'er
 
Posts: 143
Joined: Mon Apr 26, 2010 5:09 am

Re: XSL Support for templates   

Postby ozzii » Thu Dec 02, 2010 5:25 am

Here is the good one
Code: Select all
   <xsl:template match="TextElement[@Name='Runtime']">
        <xsl:variable name="hours" select="floor($Runtime div 60)"/>
        <xsl:variable name="minutes" select="$Runtime mod 60"/>
      <xsl:copy>
         <xsl:apply-templates select="@*|node()"/>
            <xsl:if test="($Runtime != '' ) and ($minutes &lt; 10)">
               <xsl:attribute name="Text"><xsl:value-of select="concat($hours,'h','0',$minutes)"/></xsl:attribute>
            </xsl:if>
            <xsl:if test="($Runtime != '' ) and ($minutes > 9)">
               <xsl:attribute name="Text"><xsl:value-of select="concat($hours,'h','',$minutes)"/></xsl:attribute>
            </xsl:if>
      </xsl:copy>
   </xsl:template>

The " from xsl:if test was not good
And the < sign doesn't work. I've changed it by &lt;
ozzii
DLX'er
 
Posts: 143
Joined: Mon Apr 26, 2010 5:09 am

Re: XSL Support for templates   

Postby ipodvi » Mon Dec 06, 2010 8:35 pm

Can you explain this to me? is this for making the wdtv live play DTSHD and Dolby Truehd pass through on say an .mkv? Or am I way off?
ipodvi
n00b
 
Posts: 14
Joined: Mon Jul 12, 2010 7:31 am

Re: XSL Support for templates   

Postby Buhric » Tue Dec 07, 2010 3:34 am

you are way off...

XSL is code that you can apply to a sheet template that will modify it on the fly...

example, you have an image at position X, but when a certain field contains information Y, you want to display a different image or set it at a position Z

so you use XSL Transforms, instead of havinf 1 temple for each case...
Buhric
Global Moderator
 
Posts: 616
Joined: Thu Apr 15, 2010 2:49 pm

Image rotation through xml ?   

Postby s1l3nc0r » Fri Dec 10, 2010 5:57 am

Is there a way in the xml (or rather a command) to rotate an object in degrees ?

like in this example, how would it be placed ?

Code: Select all
      <ImageElement Name="Folder2" X="1059" Y="485" Width="121" Height="170" Source="File" Offset="0" MultiPageIndex="-1" SourceData="" NullImageUrl="">
        <Actions>
          <RoundCorners BorderColor="-16728065" BorderWidth="2" Roundness="9" Corners="All" />
          <PerspectiveReflection Angle="270" Length="300" OffsetY="1" Opacity="70" WidthPercentage="100" />
        </Actions>
      </ImageElement>

s1l3nc0r
WDTVer
 
Posts: 29
Joined: Tue Aug 24, 2010 5:02 am

Re: XSL Support for templates   

Postby thumbgen » Fri Dec 10, 2010 6:30 am

@s1l3nc0r: To answer directly to your question: yes. How? Wait few more days and monitor taurus35 work on wdtvlive.net ;) He is preparing to release something new and very interesting ;)
Get ThumbGen!
If you like ThumbGen then buy me a coffee Image
thumbgen
Developer
 
Posts: 1058
Joined: Mon Apr 05, 2010 10:04 pm

Re: Image rotation through xml ?   

Postby Buhric » Fri Dec 10, 2010 5:46 pm

This should do it
Code: Select all
      <ImageElement Name="Folder2" X="1059" Y="485" Width="121" Height="170" Source="File" Offset="0" MultiPageIndex="-1" SourceData="" NullImageUrl="">
        <Actions>
          <RoundCorners BorderColor="-16728065" BorderWidth="2" Roundness="9" Corners="All" />
          <PerspectiveReflection Angle="270" Length="300" OffsetY="1" Opacity="70" WidthPercentage="100" />
          <Rotate Angle="50" InterpolationMode="HighQualityBicubic" />
        </Actions>
      </ImageElement>


Just put the angle like you want it...
also take not that the actions are done in the order they are...
in your take it will take the Picture, put some round corners to it, do the perspective reflection, THEN rotate... including the reflection......

So you might want to do the round corners, then rotate, then the reflection...


@ThumbGen.... now I'm curious!
Buhric
Global Moderator
 
Posts: 616
Joined: Thu Apr 15, 2010 2:49 pm

Re: XSL Support for templates   

Postby s1l3nc0r » Sat Dec 11, 2010 12:43 am

thanks for the tip Buhric

TG: you make me curious...
s1l3nc0r
WDTVer
 
Posts: 29
Joined: Tue Aug 24, 2010 5:02 am

PreviousNext

Return to ThumbGen

Who is online

Users browsing this forum: No registered users and 1 guest