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

Thread: XSL schema

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

    XSL schema

    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.

    <?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:template match="contact">
    		<article class="contact">
    				<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>
                <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>

  2. #2
    Join Date
    May 2002
    Hayward, CA
    Thanked 24 Times in 22 Posts
    Welcome to CF! Usually we prefer new questions go in a new thread (you're resurrecting a really old one here), but I don't think there's anything specifically against that in the rules. (I could be wrong.)

    That said, you're not giving us enough information to work with. To use XSL to generate XML, you have to have a data source of some kind (XML, I believe). XML + XSL = other XML. Can you show us a sample of the source XML, and what you expect the result XML to look like?
    "The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."
    June 30, 2001
    author, ES7-Membrane project (Github Pages site)
    author, Verbosio prototype XML Editor
    author, JavaScript Developer's Dictionary


Posting Permissions

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