Jump to content

steve_marjoribanks

Members
  • Content Count

    22
  • Joined

  • Last visited

Community Reputation

0 Neutral

About steve_marjoribanks

  • Rank
    Newbie
  • Birthday 12/10/1983

Contact Methods

  • Website URL
    http://
  • ICQ
    0

Profile Information

  • Location
    UK
  1. Homework question is it?! You really should be able to do that just after reading the tutorial.
  2. Well you're schema has a target namespace and your XML document is using a noNamespaceSchemaLocation attribute. The clue is in the name of the attribute. Try reading up on XML namespaces, it can be quite confusing!
  3. Your answer is no!XML Schemas are purely for validation purposes and cannot perform any sort of interactions with databases, applications or anything! You have to use a separate programming language which can be used along with XML to achieve this.
  4. This cannot be done simply by using the XML Schema langiage. Instead you have to use something like Schematron (do a google search) and use it within your schema
  5. Yes, using an XML editor such as XMLSpy or Visual Studio you can create an XML file based upon the constraints of a specified schema.
  6. I think you should strongly consider re-structuring your XML so it looks like this:<artist> <firstName>Nusrat</firstName> <lastName>Ali</lastName></artist>Using mixed content elements is not recommended for data storage of this kind.
  7. I have found that Firefox doesn't really like XSL stylesheets! Whenever I try to view an XML document with an associated XSL stylesheet in Firefox it *always* comes up with that error. This maybe something I am doing wrong, or I need to download a patch or something (in which case I would very much appreciate some input!).In answer to your question, just try it in Internet Explorer, I think it will probably work!
  8. steve_marjoribanks

    Carriage Return

    I guess you're wanting the output to be in the form of a page in a web browser? If so, your stylesheet will be in html anyhow so can't you just put a <br/> in where you want the new line?
  9. You only waited 3 hours for an answer!!! People aren't likely to jump to help you in future if you carry on with an attitude like that are they?!
  10. You can but you would use them in this case as: <cd test2="test1:test">ie. specifying the namespace in the attribute value rather than in the name. If this is causing problems you could always just get rid of the attribute and use an element instead eg.<cd> <test1:test2>test</test1:test2></cd>
  11. I'm not quite sure where you got the example from because I can't see any code with a test1:test2 attribute? As far as I'm aware test1:test2 is an invalid attribute name, they may only contain letters, numbers, dots and hyphens.To answer your second question, you use a namespace declaration attribute in the root element of your document. Something like xmlns:SOAP="insert a URL for the namespace here". Then you prefix each element in that namespace with SOAP:See http://www.w3schools.com/xml/xml_namespaces.asp for more.
  12. Not really sure where I should post this but here will do!I am currently doing quite a bit of work on a data exchange format in XML. As part of this I need to use XLink and XPointer attributes quite frequently as one of the requirements is for the data in the documents to be 'linked' to its source. Currently, as far as I'm aware there is very little (if any) software/browser support for XPointer.My question is that would it be possible (and if so how difficult) for me to write a small application which could use the XPointer stuff. ie. you could load an XML document into it and through some sort of very simple interface it could say retrieve the source of the required data when asked to and display it in another frame for example?What are everyone's views on this? How difficult would it be to write, and if not too difficult what language would you recommend writing it in, I'm guessing either Java or VB?Thanks!!!
  13. Or just this<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/"><xsl:value-of select="data/field/value/@date" /><xsl:value-of select="data/field/value/@audience" /><xsl:value-of select="data/field/value/@message" /></xsl:template></xsl:stylesheet>
  14. To get a value of an attribute you use <xsl:value-of select="@attributename" />edit: or do you mean you want to use the attribute values in the xsl code so that all 3 of the value tags are displayed correctly and not just the first one 3 times? If so you can do this using XPath, specifically by identifying the position of the element you wish to extract the data from within its parent node. See http://www.w3schools.com/xpath/xpath_syntax.asp
  15. steve_marjoribanks

    XML,XSL

    As said above, you need to make sure all your closing tags are the same as your opening tags, watch for capital letters!Again, closing tags are of the format </name> not <name/>. The reason i put it like <Recipient no="1" custno="12345" /> is that you are using an empty element and so you can use the shorthand of the /> at the end of the element. It is empty because you don't have any data stored in there, only attribute values. As mentioned above, it is generally a better idea to store data in element form as it is more versatile then.If the data has to be stored as attributes then you have to search for the data in the attributes. At the moment you are telling it to look for an element called custno, not an attribute.You need to change it to:<xsl:for-each select="Recipients/Recipient"><xsl:value-of select="@custno"/></xsl:for-each>the @ tells it to look for an attribute name and not an element name.
×
×
  • Create New...