New to xslt and need help renaming entries in xml
Posted: Thu Jun 29, 2006 6:13 pm
Hi
I'm new to all this XSLT and would really appreciate some help transforming the following xml. I'm not even sure if it is possible with xslt.
Here is an example of the source
<?xml version="1.0"?>
<main xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:/tmp/WordXML/example.xsd">
<form formID="HotelStandardAuditV2" fhUid="963" fhtUid="2645">
<formFieldList>
<formField fieldName="Car688.AtSeatEnt.B1">No</formField>
<formField fieldName="Car688.CCTV.B1">No</formField>
<formField fieldName="Car688.CETnotFull.B1">No</formField>
<formField fieldName="Car688.ExtDoorDisp.B1">No</formField>
<formField fieldName="Car688.ExtDoorDisp.B2">No</formField>
</formFieldList>
</form>
</main>
What I need to do is change the text of the field name for example from "Car688.AtSeatEnt.B1" to "Field1A_SetaInt". I'm happy to hard code the replace using strings rather than trying to make up the replacement text from the source text.
So the result should look something like this
<?xml version="1.0"?>
<main xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:/tmp/WordXML/example.xsd">
<form formID="HotelStandardAuditV2" fhUid="963" fhtUid="2645">
<formFieldList>
<formField fieldName="Field1A_SetaInt">No</formField>
<formField fieldName="Field2A_SetaInt">No</formField>
<formField fieldName="Field3A_SetaInt">No</formField>
<formField fieldName="Field4A_SetaInt">No</formField>
<formField fieldName="Field5A_SetaInt">No</formField>
</formFieldList>
</form>
</main>
Many thanks for any help you can offer. I've got a couple of books on order and need to read them thououghly I think.
I'm new to all this XSLT and would really appreciate some help transforming the following xml. I'm not even sure if it is possible with xslt.
Here is an example of the source
<?xml version="1.0"?>
<main xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:/tmp/WordXML/example.xsd">
<form formID="HotelStandardAuditV2" fhUid="963" fhtUid="2645">
<formFieldList>
<formField fieldName="Car688.AtSeatEnt.B1">No</formField>
<formField fieldName="Car688.CCTV.B1">No</formField>
<formField fieldName="Car688.CETnotFull.B1">No</formField>
<formField fieldName="Car688.ExtDoorDisp.B1">No</formField>
<formField fieldName="Car688.ExtDoorDisp.B2">No</formField>
</formFieldList>
</form>
</main>
What I need to do is change the text of the field name for example from "Car688.AtSeatEnt.B1" to "Field1A_SetaInt". I'm happy to hard code the replace using strings rather than trying to make up the replacement text from the source text.
So the result should look something like this
<?xml version="1.0"?>
<main xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:/tmp/WordXML/example.xsd">
<form formID="HotelStandardAuditV2" fhUid="963" fhtUid="2645">
<formFieldList>
<formField fieldName="Field1A_SetaInt">No</formField>
<formField fieldName="Field2A_SetaInt">No</formField>
<formField fieldName="Field3A_SetaInt">No</formField>
<formField fieldName="Field4A_SetaInt">No</formField>
<formField fieldName="Field5A_SetaInt">No</formField>
</formFieldList>
</form>
</main>
Many thanks for any help you can offer. I've got a couple of books on order and need to read them thououghly I think.