• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

XSLT question

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have following XML:
<?xml version="1.0"?>
<!-- edited with XML Spy v4.4 (http://www.xmlspy.com) by jing (UofA) -->
<?xml-stylesheet type="text/xsl" href="qset1.xsl"?>
<qset qsetnumber="1" xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance"; xmlns="http://bpa.arizona.edu/~jing"; xsd:schemaLocation="http://bpa.arizona.edu/~jing Qsetschema.xsd">
<description>This is the sample question set for XML certification.</description>
</qset>
===========================================
Then qset1.xsl is as following:
<?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"/>
<xsl:template match="/">
<html>
<head>
<title>Question Set</title>
</head>
<body>
Welcome! <xsl:value-of select="/qset/description" />
</body>
</html>
</xsl:template>
</xsl:stylesheet>
=====================================
It seems really simple. but why only "Welcome!" display in the output, not any other things like the content.
I think I install the msxml4.dll. and register it.
what else am I missing?
Thank you.

I have the
[ May 30, 2002: Message edited by: Mapraputa Is ]
 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh Hoo
You haven't typed : between Xsl and output
like <xsl:output> Secondly depends on parser some time parser of XSLT doesnot accept sequence of attributes you have given in stylesheet element
"version" comes after namespace declaration
(See XSLT By Orielly)
[ May 30, 2002: Message edited by: Mapraputa Is ]
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I found schema/namespaces problems in your XML file. When I made your XML file as
<?xml version="1.0"?>
<!-- edited with XML Spy v4.4 (http://www.xmlspy.com) by jing (UofA) -->
<?xml-stylesheet type="text/xsl" href="qset1.xsl"?>
<qset >
<description>This is the sample question set for XML certification.</description>
</qset>
It displayed the desired output.
Please check your xml file once again.
Thnx
Srikanth
divine India
Id: srikanth.vrudhula@divine.com
 
Leverager of our synergies
Posts: 10065
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
xmlns="http://bpa.arizona.edu/~jing"; part of your XML document declares so-called default namespace. Now all your elements are in this default namespace, which means corresponding XSLT elements must address them using namespace also. Like this:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:tmp="http://bpa.arizona.edu/~jing">;
...
Welcome! <xsl:value-of select="/tmp:qset/tmp:description" />


I corrected <xsl:output> thing in two posts. Unfortunately our "smiles" feature conflicts with some of XSLT elements.
[ May 30, 2002: Message edited by: Mapraputa Is ]
 
lydia westland
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much. it works!
 
There is no "i" in denial. Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic