Subject: Re: [xsl] Using of ATTLIST From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Thu, 21 Feb 2002 11:42:09 +0000 |
Hi Rüdiger, > I would like to transform a xml-document to anouther xml-document. The > generated xml-document is defined by a dtd. > > In which way is possible to use this dtd in the processing. > Especially in which way could I use specified ATTLIST for the > transforming. > > i.e. > > given xml-document > > <!ATTLIST color (red|green|blue) "green"> > > should be transformed > > <!ATTLIST new_color (yellow|magenta|cyan) "magenta"> I think that what you're asking is how to take an XML document that contains a color attribute as defined by your first ATTLIST, and create another XML document that contains a new_color attribute as defined by your second ATTLIST (and presumably with a value that reflects the value of the color attribute). [XSLT doesn't transform DTDs into other DTDs, it transforms XML documents (elements and attributes) into other documents.] So for example if you had: <foo color="red" /> then you want to get: <foo new_color="magenta" /> If that's what you want, then a way to do it would be to have a template that matches the foo element (the element on which the color attribute is defined) and creates a new foo element with a new_color attribute whose value is determined by the value of the color attribute on the source foo element: <xsl:template match="foo"> <foo> <xsl:attribute name="new_color"> <xsl:choose> <xsl:when test="@color = 'red'">magenta</xsl:when> <xsl:when test="@color = 'blue'">cyan</xsl:when> <xsl:otherwise>yellow</xsl:otherwise> </xsl:choose> </xsl:attribute> </foo> </xsl:template> There are various mapping tools around that enable you to make this mapping based on the DTDs, without writing any XSLT yourself. For example XSLWiz, CapeStudio, Stylus Studio, IBM's XSLerator. If this doesn't help, please post again with more details about what you're trying to achieve. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Using of ATTLIST, RBrand | Thread | [xsl] Re: RE: FXSL -- a functional , Dimitre Novatchev |
Re: [xsl] Euro Entity, Miguel Angel Medina | Date | [xsl] Re: RE: FXSL -- a functional , Dimitre Novatchev |
Month |