paetje Posted April 12, 2006 Share Posted April 12, 2006 I want to fill in my alt text for the use of an caption beneath my pictureThe code in XSL-T for my picture: <xsl:template match="picture"> <xsl:value-of select="."/> <xsl:variable name="src" select="@src"/> <xsl:variable name="class" select="@class"/> <img src="{$src}" class="{$class}"/> </xsl:template> code for my XML: <picture src="../Pics/cont@ct.gif" alt="this is my contact picture" class="contact"></picture> So this must give me my picture with "this is my contact picture" under it. Link to comment Share on other sites More sharing options...
boen_robot Posted April 12, 2006 Share Posted April 12, 2006 I don't see what you need the <xsl:value-of select="." /> scince the picture element is empty, but if it must be like that, so be it. As for the alt text. If it must appear in both the image and below the image: <xsl:template match="picture"> <xsl:value-of select="."/> <xsl:variable name="src" select="@src"/> <xsl:variable name="class" select="@class"/> <xsl:variable name="alt" select="@alt"/> <img src="{$src}" class="{$class}" alt="{$alt}"/> <xsl:value-of select="$alt" /></xsl:template> If it must appear only below the image, you can always remove the variable and place @alt at the last <xsl:value-of /> instead. Link to comment Share on other sites More sharing options...
paetje Posted April 12, 2006 Author Share Posted April 12, 2006 Oops forget to remove . Thanx this works. But one thing I can't figure out why. I get my alt text before my picture. And so the text is showed above my picture. Link to comment Share on other sites More sharing options...
boen_robot Posted April 12, 2006 Share Posted April 12, 2006 It works fine with me (no CSS attached). Perhaps a <br /> after the <img />? Link to comment Share on other sites More sharing options...
paetje Posted April 13, 2006 Author Share Posted April 13, 2006 It's quite strange, when I connect an class to the picture (and the alt-tekst) it puts my alt tekt on top . But when I don't have a class it shows my picture first , this is the way it supposed to be.But how can I make it the way that its always the right way ? Link to comment Share on other sites More sharing options...
boen_robot Posted April 13, 2006 Share Posted April 13, 2006 What are the class's properties? We are talking CSS problem here after all. Link to comment Share on other sites More sharing options...
paetje Posted April 13, 2006 Author Share Posted April 13, 2006 This is my contact image .contact { position: absolute; top: 350px; left: 700px; z-index: 1; } Link to comment Share on other sites More sharing options...
boen_robot Posted April 13, 2006 Share Posted April 13, 2006 Well no wonder then. Absolute positioning as far as I know places the element on the specified pixels from the screen's top left edge no matter where in the code it is. Make it relative or adjust the pixels properly. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now