Altova Mailing List Archives

Re: [xsl] nesting flat varaible structures?

From: Dan Vint <dvint@-----.--->
To: xsl-list@-----.------------.---
Date: 9/24/2011 12:48:00 AM
I'll check these out Monday when I get back to work. I read the first 
nudge from Robert and now just saw Ken's code an yours.

Not sure what more your looking for on <person>. I need to keep them 
but now wrap what are associated elements. I think my desired output 
shows everything unless I'm missing something.


At 01:53 PM 9/23/2011, you wrote:
>On Fri, 2011-09-23 at 12:25 -0700, dvint@d... wrote:
> > I'm trying to use XSLT to do a conversion from one version of the S1000D
> > spec to another. So in the older version you can have this:
> >
> > <reqpers>
> > <person man="1"/>
> > <perscat category="tech"/>
> > <trade>foo</trade>
> > <person man="2"/>
> > <perscat category="techa"/>
> > <perskill skill="sk05"/>
> > <trade>bar</trade>
> > <esttime>23</esttime>
> > </reqpers>
> >
> > In the newer version you have a nested structure:
> >
> > <reqPersons>
> > <person man="1">
> >   <personCategory personCategoryCode="tech"/>
> >   <trade>foo</trade>
> > </person>
> > <person man="2">
> >   <personCategory personCategoryCode="techa"/>
> >   <personSkill skillLevelCode="sk05"/>
> >   <trade>bar</trade>
> >   <esttime>23</esttime>
> > </person>
> > <reqPersons>
>Although it's a grouping problem I'd quite likely (depending on the
>actual schemas) have a template to match person that looked ahead and
>called apply-templates on the following elements in a mode, and have
>templates e.g. for trade, that were empty --
><xsl:template match="trade|perskill|esttime" />
><xsl:template match="trade" mode="nested">
>     <xsl:copy-of select="."/> <!--* or whatever *-->
>I see this is similar to your approach, so...
> >
> > I can use the following sibling to pull the elements under a new <person>
> > tag, but the problem is that none of the following elements are requried.
> > So this will work if I have a consistent combination of elements.
> >
> > <xsl:template match="person">
> > <person>
> >   <xsl:call-template name="processSecurityAttributes"/>
> >   <xsl:call-template name="processsChangeAttributes"/>
> >   <xsl:call-template name="processsIDAttributes"/>
> >   <xsl:call-template name="processsApplicabilityAttributes"/>
> >   <xsl:if test="@man">
> >     <xsl:attribute name="man" select="@man"/>
> >   </xsl:if>
>You can do all those at once with a mode:
>     <xsl:apply-templates
>         select="processSecurityAttribuets|removeSocks"
>         mode="my-happy-person-mode" />
>Then you don't need the for-eaches you're using.
>For the two-person-elements question you need to say what you want to
>happen in that case bfore anyone can help you with it :-)
>Liam Quin - XML Activity Lead, W3C,
>Pictures from old books:
>XSL-List info and archive:
>To unsubscribe, go to:
>or e-mail: <mailto:xsl-list-unsubscribe@l...>

Danny Vint

Panoramic Photography

voice: 619-938-3610

XSL-List info and archive:
To unsubscribe, go to:
or e-mail: <mailto:xsl-list-unsubscribe@l...>


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 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.