Click here to Skip to main content
15,909,530 members
Home / Discussions / XML / XSL
   

XML / XSL

 
GeneralRe: Types in Schema Pin
Michael A. Barnhart15-May-02 13:53
Michael A. Barnhart15-May-02 13:53 
GeneralNewbie needs help with a schema. Pin
nay10-May-02 10:10
nay10-May-02 10:10 
GeneralRe: Newbie needs help with a schema. Pin
Michael A. Barnhart11-May-02 0:41
Michael A. Barnhart11-May-02 0:41 
GeneralRe: Newbie needs help with a schema. Pin
nay11-May-02 4:45
nay11-May-02 4:45 
GeneralUsing XSL to filter the data from XML Pin
5-May-02 22:49
suss5-May-02 22:49 
GeneralRe: Using XSL to filter the data from XML Pin
MS le Roux6-May-02 5:41
MS le Roux6-May-02 5:41 
GeneralRe: Using XSL to filter the data from XML Pin
6-May-02 18:14
suss6-May-02 18:14 
GeneralRe: Using XSL to filter the data from XML Pin
MS le Roux6-May-02 22:16
MS le Roux6-May-02 22:16 
I'm guessing your XML looks something like this:
<cards>
 <card><CardType>1</CardType>
  <data>
   <record>
    <field1>
     <CardLicenceOption>1</CardLicenceOption>
     <CardLicenceOptionDescription>Credit</CardLicenceOptionDescription>
    </field1>
    <field1>
     <CardLicenceOption>2</CardLicenceOption>
     <CardLicenceOptionDescription>Charge</CardLicenceOptionDescription>
    </field1>
   </record>
  </data>
 </card>
 <card><CardType>3</CardType>
  <CardOptionParent1>1</CardOptionParent1>
  <CardOptionDescription>Cash</CardOptionDescription>
 </card>
</cards>


It looks like you're using incorrect paths to access your XML elements. The following XSLT should work:
<xsl:for-each select="//card">
 <tr><td width="50%">Credit Card Option1
  <xsl:choose>
  
   <xsl:when test="CardType=3">
    <xsl:element name="select">
     <xsl:attribute name="name">D2</xsl:attribute>
     <xsl:element name="option">
      <xsl:attribute name="value">
       <xsl:value-of select="CardOptionParent1" />
      </xsl:attribute>
      <xsl:value-of select="CardOptionDescription" />
     </xsl:element>
    </xsl:element>
   </xsl:when>
   
   <xsl:when test="CardType=4">
    <xsl:element name="select">
     <xsl:attribute name="name">D2</xsl:attribute>
     <xsl:element name="option">
      <xsl:attribute name="value">
       <xsl:value-of select="CardOptionParent2" />
      </xsl:attribute>
      <xsl:value-of select="CardOptionDescription" />
     </xsl:element>
    </xsl:element>
   </xsl:when>
   
   <xsl:otherwise>
    <xsl:element name="select">
     <xsl:attribute name="name">D2</xsl:attribute>
     <xsl:for-each select="data/record/field1">
      <xsl:element name="option">
       <xsl:attribute name="value">
        <xsl:value-of select="CardLicenceOption"/>
       </xsl:attribute>
       <xsl:value-of select="CardLicenceOptionDescription" />
      </xsl:element>
     </xsl:for-each>
    </xsl:element>
   </xsl:otherwise>
  </xsl:choose>
 </td></tr>
</xsl:for-each>

GeneralXML Logging (Your thoughts) Pin
3-May-02 19:58
suss3-May-02 19:58 
GeneralRe: XML Logging (Your thoughts) Pin
Michael A. Barnhart4-May-02 1:52
Michael A. Barnhart4-May-02 1:52 
GeneralRe: XML Logging (Your thoughts) Pin
Erik Westermann5-May-02 7:46
professionalErik Westermann5-May-02 7:46 
GeneralRe: XML Logging (Your thoughts) Pin
Todd.Harvey6-May-02 9:09
Todd.Harvey6-May-02 9:09 
GeneralRe: XML Logging (Your thoughts) Pin
David Chamberlain17-May-02 3:49
David Chamberlain17-May-02 3:49 
GeneralOutputting a !DOCTYPE declaration from an XSL stylesheet Pin
Domenic Denicola3-May-02 4:23
Domenic Denicola3-May-02 4:23 
GeneralRe: Outputting a !DOCTYPE declaration from an XSL stylesheet Pin
Michael A. Barnhart3-May-02 15:20
Michael A. Barnhart3-May-02 15:20 
GeneralRe: Outputting a !DOCTYPE declaration from an XSL stylesheet Pin
Domenic Denicola4-May-02 17:06
Domenic Denicola4-May-02 17:06 
GeneralRe: Outputting a !DOCTYPE declaration from an XSL stylesheet Pin
Erik Westermann4-May-02 19:55
professionalErik Westermann4-May-02 19:55 
GeneralRe: Outputting a !DOCTYPE declaration from an XSL stylesheet Pin
Domenic Denicola5-May-02 6:27
Domenic Denicola5-May-02 6:27 
GeneralRe: Outputting a !DOCTYPE declaration from an XSL stylesheet Pin
Erik Westermann5-May-02 7:38
professionalErik Westermann5-May-02 7:38 
GeneralRe: Outputting a !DOCTYPE declaration from an XSL stylesheet Pin
Domenic Denicola5-May-02 11:31
Domenic Denicola5-May-02 11:31 
GeneralRe: Outputting a !DOCTYPE declaration from an XSL stylesheet Pin
Michael A. Barnhart5-May-02 2:56
Michael A. Barnhart5-May-02 2:56 
GeneralRe: Outputting a !DOCTYPE declaration from an XSL stylesheet Pin
Domenic Denicola5-May-02 6:24
Domenic Denicola5-May-02 6:24 
GeneralRe: Outputting a !DOCTYPE declaration from an XSL stylesheet Pin
Michael A. Barnhart5-May-02 8:47
Michael A. Barnhart5-May-02 8:47 
GeneralRe: Outputting a !DOCTYPE declaration from an XSL stylesheet Pin
Domenic Denicola5-May-02 11:29
Domenic Denicola5-May-02 11:29 
GeneralRe: Outputting a !DOCTYPE declaration from an XSL stylesheet Pin
Michael A. Barnhart5-May-02 12:59
Michael A. Barnhart5-May-02 12:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.