Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


[xsl] FW: Getting a flat mapping of XSLT fields for documentation purposes...

From: "Minas Casiou" <minas@--------------->
To:
Date: 6/1/2007 2:03:00 PM
From: Minas Casiou [mailto:minas@xxxxxxxxxxxxxxx]
Sent: Friday, 1 June 2007 11:57 PM
To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
Cc: 'Minas Casiou'
Subject: Getting a flat mapping of XSLT fields for documentation purposes...

Hi,
I'm trying to put together an XSLT which will take an arbitrary XSLT (that
maps data from one XSD schema to another XSD schema), and provides (on a
best-effort basis) a flat view of the mapping from the point of view of the
XSD being mapped to.

i.e.
If I've got 3 files:
        1)XSDInput.xsd - defines input data format
        2)XSDOutput.xsd - defines output data format
and
        3)XSLTmapper.xslt - maps from input data format (XSDInput.xsd) to
output data format (XSDOutput.xsd)

I want to create a generic XSLT file:
        - -> XSLTFlatMappingForDoco.xslt
that takes various
        XSLTMapper.xslt
files, and produces something like:

<Maps>
<Map>
  <from>s1:StreetName</from>
  <to>s0:Pda_Inf_Street_Name</to>
</Map>
<Map>
  <from>s1:StreetType</from>
  <to>s0:Pda_Inf_Street_Type</to>
</Map>
<Map>
  <from>s1:StreetSuffix1</from>
  <from>s1:StreetSuffix2</from>
  <to>s0:Pda_Inf_Street_Suffix</to>
</Map>
....
</Maps>

which says that field
        s0:Pda_Inf_Street_Name
comes from:
        s2:StreetName

and
  <from>s1:StreetSuffix1</from>
  <from>s1:StreetSuffix2</from>
  <to>s0:Pda_Inf_Street_Suffix</to>

        s0:Pda_Inf_Street_Suffix
comes from:
        s1:StreetSuffix1
        s1:StreetSuffix2

etc.

Any other additional info would be a bonus, but I'm not too fussed about that
right now...bigger problems trying to do just the above!

I've got this so far...

<?xml version='1.0' ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:s0="URN:AU.GOV.NSW.POLICE.XML.SERVICE.APPLICATION.COPSEVENT.CAD400NWS.V
ERSION_1_0_0">
        <xsl:output method="xml" encoding="UTF-8" indent="yes"/>

        <xsl:template match="*">
        <Maps>
                <xsl:for-each select="descendant-or-self::xsl:value-of">
                        <Map>
                                <from>
                                        <xsl:value-of
select="../../parent::xsl:for-each/@select"/>
                                </from>
                                <to>
                                        <xsl:value-of select="name(../.)"/>
                                </to>
                        </Map>
                </xsl:for-each>
        </Maps>
        </xsl:template>
</xsl:stylesheet>

which sort of does a liiiiitle bit of the job (completely useless at this
point...).

Has anyone done this sort of thing before, or know how to approach it?
I'm completely lost for how to do it using XSLT. I don't want to have to
resort to code. I suspect that'll be even uglier.

Thanks



Cheers

Minas Casiou |  ESB Technical Architect I&I | MRP -  Mainframe Replacement
Program    |  BTS  |  New  South  Wales  Police
Phone: 02 9689 7610 |  Eaglenet: 79610  |  Mobile: 0431 103 925  |  email:
casi1min@xxxxxxxxxxxxxxxxx
This message and any attachment is confidential and may
be privileged or otherwise protected from disclosure. If you
have received it by mistake, please let us know by reply
and then delete it from your system; you should not copy
the message or disclose its contents to anyone.


transparent
Print
Mail
Digg
delicious
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