Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. Schema and Stylesheet

Schema and Stylesheet

Scheduled Pinned Locked Moved XML / XSL
xmldatabasehelpquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Chetan Ranpariya
    wrote on last edited by
    #1

    Hi Friends, I am using XML as database in my application and for datadefinition in xml file I create .xsd file (schema file) and set the target schema property to the .xsd file. Till that every thing is working fine. NOw I am trying to export the xml file to msexcel worksheet. and for that I have created an .xslt file which formats data of xml file. The problem is that the stylesheets works properly only if the xml file is not bind to the schema file. If I bind the xml file to the schema file it give nothing as output and without schema data validation is not possible. Is there any way to bind schema and stylesheet together? if any one is having this idea plz let me know. Thank u all in advance. Thanks and regards, Chetan Ranpariya.

    G 1 Reply Last reply
    0
    • C Chetan Ranpariya

      Hi Friends, I am using XML as database in my application and for datadefinition in xml file I create .xsd file (schema file) and set the target schema property to the .xsd file. Till that every thing is working fine. NOw I am trying to export the xml file to msexcel worksheet. and for that I have created an .xslt file which formats data of xml file. The problem is that the stylesheets works properly only if the xml file is not bind to the schema file. If I bind the xml file to the schema file it give nothing as output and without schema data validation is not possible. Is there any way to bind schema and stylesheet together? if any one is having this idea plz let me know. Thank u all in advance. Thanks and regards, Chetan Ranpariya.

      G Offline
      G Offline
      George L Jackson
      wrote on last edited by
      #2

      Since your XML file uses a Schema, it has a default namespace. I believe you have to have your XSLT recognize the namespace of the nodes it is transforming.

      C 1 Reply Last reply
      0
      • G George L Jackson

        Since your XML file uses a Schema, it has a default namespace. I believe you have to have your XSLT recognize the namespace of the nodes it is transforming.

        C Offline
        C Offline
        Chetan Ranpariya
        wrote on last edited by
        #3

        Hi George, Thank you for the reply. The way u suggest it right but I dont know how to do that? The xslt file that I had made is like this. <?xml version="1.0" encoding="utf-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" version="1.0" encoding="UTF-8"></xsl:output> <xsl:template match="/"> <xsl:param name="CompCode"/> <html> <body> <h2>Activities</h2> <table border="1" cellpadding ="2"> <tr bgcolor="#9acd32"> <th>Sequence Number</th> <th>Details</th> </tr> <xsl:for-each select="CompsAndRels/RelationshipMaster[ProjectCode=$CompCode]"> <xsl:sort select="SequenceNumber" data-type="number"></xsl:sort> <xsl:variable name="recursive_result"> <xsl:value-of select="RelCode"></xsl:value-of></xsl:variable> <tr> <td colspan="2"> <b> <xsl:value-of select="SequenceNumber"></xsl:value-of>. <xsl:value-of select="RelDescription"></xsl:value-of></b> </td> </tr> <xsl:for-each select="../ActivityMaster[ActivityRelCode=$recursive_result]"> <xsl:sort select="ActivitySeqNo" data-type="number"></xsl:sort> <tr> <td bgcolor="#ffffcc"> <xsl:value-of select="ActivitySeqNo"></xsl:value-of> </td> <td bgcolor="#ffffcc"> <xsl:value-of select="ActivityDetail"></xsl:value-of> </td> </tr> </xsl:for-each> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet> and My XML file is as following. <CompsAndRels xmlns="http://tempuri.org/ComponentsAndRelationships.xsd"> <ComponentMaster> <ComponentCode>35476350</ComponentCode> <ComponentName>BRUSH</ComponentName> <ComponentDescription>fa;sl asd.fas dlf;as f.sdf aslj</ComponentDescription> <ComponentParent>0</ComponentParent> <ComponentCost>500</ComponentCost> <CompnentWorth>500</CompnentWorth> <UserID>mrchetanrana</UserID> <ProjectCode>5847</ProjectCode> <ComponentColor>ffffff</ComponentColor> &

        G 1 Reply Last reply
        0
        • C Chetan Ranpariya

          Hi George, Thank you for the reply. The way u suggest it right but I dont know how to do that? The xslt file that I had made is like this. <?xml version="1.0" encoding="utf-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" version="1.0" encoding="UTF-8"></xsl:output> <xsl:template match="/"> <xsl:param name="CompCode"/> <html> <body> <h2>Activities</h2> <table border="1" cellpadding ="2"> <tr bgcolor="#9acd32"> <th>Sequence Number</th> <th>Details</th> </tr> <xsl:for-each select="CompsAndRels/RelationshipMaster[ProjectCode=$CompCode]"> <xsl:sort select="SequenceNumber" data-type="number"></xsl:sort> <xsl:variable name="recursive_result"> <xsl:value-of select="RelCode"></xsl:value-of></xsl:variable> <tr> <td colspan="2"> <b> <xsl:value-of select="SequenceNumber"></xsl:value-of>. <xsl:value-of select="RelDescription"></xsl:value-of></b> </td> </tr> <xsl:for-each select="../ActivityMaster[ActivityRelCode=$recursive_result]"> <xsl:sort select="ActivitySeqNo" data-type="number"></xsl:sort> <tr> <td bgcolor="#ffffcc"> <xsl:value-of select="ActivitySeqNo"></xsl:value-of> </td> <td bgcolor="#ffffcc"> <xsl:value-of select="ActivityDetail"></xsl:value-of> </td> </tr> </xsl:for-each> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet> and My XML file is as following. <CompsAndRels xmlns="http://tempuri.org/ComponentsAndRelationships.xsd"> <ComponentMaster> <ComponentCode>35476350</ComponentCode> <ComponentName>BRUSH</ComponentName> <ComponentDescription>fa;sl asd.fas dlf;as f.sdf aslj</ComponentDescription> <ComponentParent>0</ComponentParent> <ComponentCost>500</ComponentCost> <CompnentWorth>500</CompnentWorth> <UserID>mrchetanrana</UserID> <ProjectCode>5847</ProjectCode> <ComponentColor>ffffff</ComponentColor> &

          G Offline
          G Offline
          George L Jackson
          wrote on last edited by
          #4

          ... Any references to your document (CompsAndRels) must be made through the "car" namespace (car:CompsAndRels). -- modified at 16:33 Tuesday 28th March, 2006

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups