Subject:Identity Transform problem. Hibernate Mapping Author:alejandro salas Date:23 Jun 2006 05:34 PM
Hi everyone,
I'm new to xslt so this may be a very dumb question. I'm trying to transform an Hibernate Mapping (template) file, into a complete mapping file.
My template:
----------------------------
<?xml version="1.0"?>
I want to fill the name and table attributes in the class element, and the name attribute in the property element. (All values should come from another xml.)
My first attempt was to transform it including dummy values so that I could figure out later how to import the values from a different xml file. My xslt copies everything but the class element and the property element, I've had problems figuring out the rest.
Here's my xslt:
------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
Subject:Identity Transform problem. Hibernate Mapping Author:alejandro salas Date:23 Jun 2006 05:47 PM
I actually managed to change add a couple of things, my output xml is fine now, but I need to know how could I import the values I want from another xml (all the attributes must be added from that other source). And another thing is that I'm pretty sure there's a better way to do it, so, any help is greatelly appreciated. Here's my xslt:
---------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
One of the problems I encountered is that the elements in my output xml appeared with a lot of other attributes (the ones defined in the dtd).
Example:
<property name="someProp" unique="false" optimistic-lock="true" lazy="false" generated="never" /> instead of just
<property name="someProp"/>
As I said before I couldn't figure out how to transform my xml template using another file as input. I solved it using DOM, but I'd like to use transformations instead.
Subject:Identity Transform problem. Hibernate Mapping Author:Ivan Pedruzzi Date:28 Jun 2006 01:15 AM Originally Posted: 28 Jun 2006 01:12 AM
I am not sure how your template works.
Please see the attached solution that demonstrates the following
- generating a reference to a DTD in the output document using xsl:output
- implementing an identity transformation that copies everything in input to the output
- use the document function to access a document other then the default input document
The attributes you see appearing in the output come from the DTD schema either when there is reference in the XML input document or when the XSLT output generates the doctype