What's wrong with my code Version 1.0 (Altova XMLSPY)
Hello all, Man I think I am going to be crazy now! I've just started defining a style sheet, but I am getting crazy results. Before I show my input and I would like to describe I am trying to debug my stylesheet from past four hours. Almost changed my stylesheet thrice or more but all the time I am getting the strange output shown below. Here are few things I would like to mention before you look into it: 1. I am working on Windows XP OS using Altova's XMLSpy Enterprise Edition. 2. I can figure out one thing that I am unable to access the nodes, attributes, attribute values almost nothing in XML though can get the text of whole document when I display string of root element. 3. I have even removed the dtd path declarations on my XML inputs as I was initially was not even able to access the root element, but the same result while accessing the nodes and attributes for rest. 4. I am also sure that I am missing something very important in using Altova, as a newbie in Altova and XSLT also. 5. Just to add I am using Altova's Built-in XSLT engine (which have given perfect results in many of my other projects). Any hint in this regard will make my day. Thanks a lot. Pankaj Chaturvedi XML Input ========= <?xml version="1.0" encoding="iso-8859-1"?> <NewsML Version="1.0"> <NewsEnvelope> <SentFrom> <Party FormalName="System"> <Property FormalName="Name" Value="CCI Europe NewsDesk"/> <Property FormalName="NewsRoom" Value="San Francisco Chronicle"/> </Party> </SentFrom> <DateAndTime>20080515T233400-0700</DateAndTime> </NewsEnvelope> <NewsItem> <Identification> <NewsIdentifier> <ProviderId>www.sfgate.com</ProviderId> <DateId>20080516</DateId> <NewsItemId>3810NMDI</NewsItemId> <RevisionId PreviousRevision="0" Update="N">3</RevisionId> </NewsIdentifier> </Identification> </NewsItem> </NewsML> Stylesheet =========== <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="yes" encoding="UTF-8"/> <xsl:template match="/"> <XMLFileCollection> <XMLFile> <issueinfo> <!-- Issue Level title Information --> <xsl:apply-templates select="NewsEnvelop//Party"/> <xsl:apply-templates select="NewsItem"/> <!-- Article Tag with language attribute (English is default) --> </issueinfo> </XMLFile> </XMLFileCollection> </xsl:template> <xsl:template match="NewsEnvelop//Party"> <!-- Title --> <title><xsl:value-of select="./Property[@FomalName='NewsRoom']/@Value"/></title> </xsl:template> <xsl:template match="NewsItem"> <pubdate><xsl:value-of select="string(./Identification/NewsIdentifier/DateId)"/></pubdate> </xsl:template> </xsl:stylesheet> Output ======== <?xml version="1.0" encoding="UTF-8"?> <XMLFileCollection> <XMLFile> <issueinfo/> </XMLFile> </XMLFileCollection> Best, Pankaj Chaturvedi ============================================================================ ================ Confidentiality Notice:" This message and any attachment(s) contained here are information that is confidential, proprietary to IDS Infotech Ltd. and its customers. Contents may be privileged or otherwise protected by law. The information is solely intended for the individual or the entity it is addressed to. If you are not the intended recipient of this message, you are not authorized to read, forward, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately by return e-mail and delete it from your computer."
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format