Subject: [xsl] FW: Getting a flat mapping of XSLT fields for documentation purposes... From: "Minas Casiou" <minas@xxxxxxxxxxxxxxx> Date: Sat, 2 Jun 2007 00:02:40 +1000 |
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.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xsl:element will not crea, David Carlisle | Thread | RE: [xsl] FW: Getting a flat mappin, Michael Kay |
Re: [xsl] xsl:element will not crea, N David Brown | Date | [xsl] tokenize() a string and then , hajduk |
Month |