Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


XSLT Question

From: "gwoodhouse@-----.---" <----------@-----.--->
To: NULL
Date: 7/17/2009 2:45:00 AM
Hello,

I'm trying to transform XML that can come in server forms,

The XML i get is along these lines (This is example simplified code)

<composer>
  <composer_if>jim</composer_if>
  <composer_epithet>mr</composer_epithet>
</composer>

or

<artist>
  <artist_if>bob</artist_if>
  <artist_epithet>sir</artist_epithet>
</artist>

(or any number of different permutations of this)

I'm trying to use this code to display it in the form Mr, Jim or Sir,
Bob:

	<xsl:template match="advertiser|artist|box_office|company|composer|
distributor|editor|for_benefit_of|lessee|owner|premises_owner|
producer_director|scenery_designer|signatory">
		<xsl:choose>
			<xsl:when test="main[@display = 'yes']">
				<xsl:apply-templates select="main"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:variable name="if">
					<xsl:value-of select="name()"/><xsl:text>_if</xsl:text>
				</xsl:variable>
				<xsl:variable name="epithet">
					<xsl:value-of select="name()"/><xsl:text>_epithet</xsl:text>
				</xsl:variable>
				<xsl:apply-templates select="$if"/>, <xsl:apply-templates
select="$epithet"/>
			</xsl:otherwise>
		</xsl:choose>
		<xsl:apply-templates/>
	</xsl:template>

But the XSLT proccessor doesn't like using variable's in its "select"
attribute.

Does anyone know a way around this without changing the XML being
passed in?

Thanks

Graeme




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent