Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Schema in XSL

  1. #1
    New to the CF scene
    Join Date
    Jan 2014
    Location
    Cardiff, Wales.
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Schema in XSL

    Hey guys, first post so go easy on me. New to using XSL and also new to Schema btu we have a .net application that uses XSL to output XML files calling data such as contacts etc which I would like to add schema attributes to the xsl file so it automatically shows those attributes in the finished page.

    Here is the current XSL code, can someone show me how or where I would add the schema attributes? (just for reference, I have picked up this project 3 years after it was written and converting to C#. Not really had much to do with XSL before.

    Thanks in advance.

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    
        <xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />
    
        <xsl:template match="*">
            <xsl:if test="count(contact) &gt; 0">
    			<xsl:apply-templates select="contact" />
            </xsl:if>
        </xsl:template>
    
        <xsl:template match="contact">
    		<article class="contact">
    			<xsl:choose>
    				<xsl:when test="@image"><img src="/_resources/files{@image}" alt="Front Cover" /></xsl:when>
    				<xsl:otherwise><img src="/_resources/files/content/contacts/contacts-awaiting-image.jpg" alt="Awaiting Image" /></xsl:otherwise>
    			</xsl:choose>
                <h1><xsl:value-of select="@title" />. <xsl:value-of select="@name" /></h1>
                <p><xsl:value-of select="@position" /><xsl:if test="@company != 'IEF'"><xsl:text> </xsl:text>(<xsl:value-of select="@company" />)</xsl:if><br /><xsl:value-of select="@telephone" /></p>
            </article>
        </xsl:template>
    
    </xsl:stylesheet>

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,608
    Thanks
    24
    Thanked 647 Times in 646 Posts
    You need to post the xml this xsl is linked to before we can do anything.
    Evolution - The non-random survival of random variants.

    "If you leave hydrogen alone, for long enough, it begins to think about itself."

  • #3
    New to the CF scene
    Join Date
    Jan 2014
    Location
    Dubai, UAE
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The declaration of xml:space and xml:lang may need to be commented out because of problems processing the schema using various tools.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •