Jump to content

XSLT for documenting another XSLT

Recommended Posts

Hi,I have an XSLT which uses common phrases to implement multilingual support. I would like to have a another xslt which could easily show up which phrases are used and where they are usedExample of usage:

<!-- usage in xslt --><xsl:value-of select="$phrases/Value[@name='HEADER_title']/child::*[name() = $languageCode]"/><!-- replacements -->"<xsl:value-of select="$phrases/Value[@name='" should be replace  as "Phrase:""']/child::*[name() = $languageCode]"/>" and respectively should replace as empty string

How can I implement this with xsl version 1.0?I'm thankful for any help or thoughts you might bring in to this topic

Link to post
Share on other sites

Sorry, I don't understand what you want to achieve. Processing XSLT with XSLT is possible as XSLT is XML but other than that I don't understand what you want to achieve so far. You might want to show a sample of the XSLT you have and the corresponding output you want to create.

Edited by Martin Honnen
Link to post
Share on other sites

Ok I'll try my best, this is simplified version of xslt I have:

<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">	<xsl:output method="html" version="1.0" encoding="UTF-8" indent="no" omit-xml-declaration="yes" doctype-public="-//W3C/DTD XHTML 1.0Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" standalone="yes" media-type="text/html"/>	<xsl:variable name="phrases" select="document('invoice_phrases.xml')/phrases"/>	<xsl:template match="Invoices"><xsl:variable name="languageCode" select="Header/LangCode"/>		<html>			<head>				<title/>				<link rel="stylesheet" type="text/css" href="invoice_styles.css" title="Style"/>			</head>			<body>				<h1><xsl:value-of select="$phrases/Value[@name='HEADER_title']/child::*[name() = $languageCode]"/>				</h1>			</body>		</html>	</xsl:template>

And this is from invoice_phrases.xml:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><phrases xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">	<Value name="HEADER_title">		<DE>Invoice in germany</DE>		<EN>Invoice</EN>	</Value></phrases>

In order to find out which phrases are used and where in the initial xslt, I would like to make another xslt which will automatically "document" it by using the same layout but replaces "<xsl:value-of select="$phrases/Value[@name=" with string "Phrase variable:"and rest of it &quot]/child::*[name() = $languageCode]"/>" with empty string. At the end I would have the same html layout, but phrases are replaced with variable names instead of valid translations like in example: the html output is replaced as follows depending on a language code value of "HEADER_title" in phrases.xml is replaced with PHRASE: HEADER_titleI know it's a mess when I try to explain something, it only gets from bad to worse

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...