• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XSLT question

 
lydia westland
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">
<xslutput 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 ]
 
Syed AliRaza Zaidi
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 <xslutput> 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 ]
 
Srikanth Vrudhula
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
 
Mapraputa Is
Leverager of our synergies
Sheriff
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 <xslutput> 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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic