Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 24th, 2005, 09:56 AM
Authorized User
 
Join Date: Jun 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default need xsl style sheet help please!(im a begginer)

here is an xml doc.
<?xml version="1.0" encoding="UTF-8"?>
<questestinterop>
    <assessment title="Quiz 1">
        <assessmentmetadata>
            <bbmd_asi_object_id>_20619_1</bbmd_asi_object_id>
            <bbmd_asitype>Assessment</bbmd_asitype>
            <bbmd_assessmenttype>Pool</bbmd_assessmenttype>
            <bbmd_sectiontype>Subsection</bbmd_sectiontype>
            <bbmd_questiontype>Multiple Choice</bbmd_questiontype>
            <bbmd_is_from_cartridge>false</bbmd_is_from_cartridge>
            <qmd_absolutescore>0.0,12.0</qmd_absolutescore>
            <qmd_absolutescore_min>0.0</qmd_absolutescore_min>
            <qmd_absolutescore_max>12.0</qmd_absolutescore_max>
            <qmd_assessmenttype>Proprietary</qmd_assessmenttype>
            <qmd_itemtype>Logical Identifier</qmd_itemtype>
            <qmd_levelofdifficulty>School</qmd_levelofdifficulty>
            <qmd_maximumscore>0.0</qmd_maximumscore>
            <qmd_numberofitems>0</qmd_numberofitems>
            <qmd_renderingtype>Proprietary</qmd_renderingtype>
            <qmd_responsetype>Single</qmd_responsetype>
            <qmd_scoretype>Absolute</qmd_scoretype>
            <qmd_status>Normal</qmd_status>
            <qmd_timelimit>0</qmd_timelimit>
            <qmd_weighting>0.0</qmd_weighting>
            <qmd_typeofsolution>Complete</qmd_typeofsolution>
        </assessmentmetadata>
        <rubric view="All">
            <flow_mat class="Block">
                <material>
                    <mat_extension>
                        <mat_formattedtext type="SMART_TEXT"/>
                    </mat_extension>
                </material>
            </flow_mat>
        </rubric>
        <presentation_material>
            <flow_mat class="Block">
                <material>
                    <mat_extension>
                        <mat_formattedtext type="SMART_TEXT"/>
                    </mat_extension>
                </material>
            </flow_mat>
        </presentation_material>
        <section>
INEED HELP TO PRODUCE an xsl sheet that make it look something like this
<?xml version="1.0" encoding="UTF-8" ?>
- <pools>
<pool>Quiz 1</pool>
- <questions>
- <question number="1" options="4" ref="790ACB01F89E11D687E1687F532E803D">
<qtext>Which of the following Java statements contains a syntax error?</qtext>
<qoption number="1" status="790ACB00F89E11D687E1687F532E803D">int studentAge;</qoption>
<qoption number="2" status="790ACB01F89E11D687E1687F532E803D">studentA ge int;</qoption>
<qoption number="3" status="790ACB02F89E11D687E1687F532E803D">int studentAge = 21;</qoption>
<qoption number="4" status="790ACB03F89E11D687E1687F532E803D">int studentAge; //declare studentAge as an integer</qoption>
</question>
- <question number="2" options="4" ref="34E63940F89F11D687E1687F532E803D">
<qtext>Which of the following Java data types is most appropriate when used to declare a variable denoting a telephone number?</qtext>
<qoption number="1" status="34E63940F89F11D687E1687F532E803D">String</qoption>
<qoption number="2" status="34E63941F89F11D687E1687F532E803D">int</qoption>
<qoption number="3" status="34E63942F89F11D687E1687F532E803D">char</qoption>
<qoption number="4" status="34E63943F89F11D687E1687F532E803D">double</qoption>
</question>
please any advice 1'm struglling big time with Xpathif e-mail please use thi link
 
Old July 25th, 2005, 07:06 AM
Authorized User
 
Join Date: Jun 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

here what i have done so far i used this xsl doc:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="/questestinterop">
  <html>
  <body>
   <p><pools>Quiz 1</pools></p>

    <xsl:for-each select="assessment">



       <xsl:for-each select="//section">

      <xsl:for-each select="//item/flow"></xsl:for-each>
   <Question number="1" options ="4" status="flow_label" ></Question><gTxT> <xsl:value-of select="item//presentation/flow/flow/flow/material/mat_extension//mat_formattedtext"></xsl:value-of></gTxT>
<qoption number="1" status=""><xsl:value-of select="item//flow/response_lid/render_choice/flow_label"></xsl:value-of> </qoption>
 <qoption number="2" status=""><xsl:value-of select="item//flow/flow_label/response_label/flow_mat/material/mat_extension/mat_formattedtext"></xsl:value-of> </qoption>

   </xsl:for-each>
        </xsl:for-each>

  </body>
  </html>
</xsl:template>
</xsl:stylesheet>

to produce the following:
- <html xmlns:fo="http://www.w3.org/1999/XSL/Format">
- <body>
- <p>
  <pools>Quiz 1</pools>
  </p>
  <Question number="1" options="4" status="flow_label" />
  <gTxT>Which of the following Java statements contains a syntax error?</gTxT>
  <qoption number="1" status="">int studentAge;</qoption>
  <qoption number="2" status="" />
  </body>
  </html>
all i want to do now is to create a xsl goe through the whole above documents with out repeating the code: i need a code that uses an Xpath..please

 
Old July 25th, 2005, 02:10 PM
Authorized User
 
Join Date: Jun 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I know i'm sad answering my self but here what i managed to do.. i managed to display the whole questin using 1 XSL sheet as follow:

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">

<xsl:template match="/questestinterop">

<html>

<body>

<p><pools>Quiz 1</pools></p>


<xsl:for-each select="assessment">




<xsl:for-each select="section/item/presentation">



<Question number="1" options ="4" ref ="ident"></Question><gTxT> <xsl:value-of select="flow/flow//flow//mat_formattedtext"></xsl:value-of></gTxT>

<xsl:for-each select="flow_mat/material">

<qoption number="1" status=""><xsl:value-of select="flow/flow/flow//mat_extension"></xsl:value-of> </qoption>





</xsl:for-each>

</xsl:for-each>

</xsl:for-each>



</body>

</html>

</xsl:template>

</xsl:stylesheet>

but what i couldnt manage is to display the answer in the following lines could any one advice please
hamza30@hotmail.com








Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 2 -- Style Sheet problem. Doug Happ BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 4 January 10th, 2008 01:14 PM
add xsl style sheet in generated xhtml using xslt. kvmreddy XSLT 2 April 10th, 2006 02:22 PM
cascading style sheet problem nikotromus ASP.NET 2.0 Professional 0 March 24th, 2006 07:49 PM
assigning a css style sheet from an element miguel XSLT 7 August 8th, 2004 01:21 PM
Setting the Style Sheet class jacob ASP.NET 1.0 and 1.1 Basics 4 August 20th, 2003 01:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.