Subject: [xsl] XSL newbie help needed From: "Ashley Mort" <Ashley_C_Mort@xxxxxxxxxxxx> Date: Thu, 16 Sep 2004 09:35:07 -0400 |
Below is an .xsd document. I want to display all @type that is a model of a car. For example I want the output to be: Ford Focus Mustang F150 Taurus <xsd:schema> <xsd:element name="ford" type="Ford" substitutionGroup="car"/> <xsd:element name="focus" type="Focus" substitutionGroup="ford"/> <xsd:element name="mustang" type="Mustang" substitutionGroup="ford"/> <xsd:element name="f150" type="F150" substitutionGroup="ford"/> <xsd:element name="taurus" type="Taurus" substitutionGroup="ford"/> <xsd:element name="firestone" type="Firestone" substitutionGroup="tires"/> <xsd:schema> Here is an XSL stylesheet that does what I want but I need the 2nd "if" to be a variable that is the NAME where substitutionGroup="car". It can't be hard coded because I need the same XSL to transform additional XSDs. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:mdc="http://us.mil.dcgs/metadata" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsl:template match="/"> <xsl:for-each select="descendant::xsd:element"> <xsl:if test="contains(@substitutionGroup,'car')"> <xsl:value-of select="@type"/><xsl:text> </xsl:text> </xsl:if> <xsl:if test="contains(@substitutionGroup,'ford')"> <!-- ford should not be hard coded --> <xsl:value-of select="@substitutionGroup"/>-<xsl:value-of select="@type"/> <xsl:text> </xsl:text> </xsl:if> </xsl:for-each> </xsl:template> </xsl:stylesheet> ------------------------------------ Raytheon Ashley Mort Software Engineer 1 Ashley_C_Mort@xxxxxxxxxxxx 300 Science Park Rd State College, PA 16803 tel: 814 278 3920 ------------------------------------ --+------------------------------------------------------------------ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/ or e-mail: <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx> --+--
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] <xsl:test="">, Phillip Nicolson | Thread | AW: [xsl] XSL newbie help needed, christof.hoeke |
Re: [xsl] Exclude elements in trans, M. David Peterson | Date | AW: [xsl] XSL newbie help needed, christof.hoeke |
Month |