Changing labels with CssSelector

44 views
Skip to first unread message

Francois

unread,
Mar 6, 2012, 12:21:54 PM3/6/12
to lif...@googlegroups.com
Hello guys,

I still don't master CssSelector transformation.

I would like to use them to transform something like:

<people version="1"
otherProp="prop">
  <name>foo</name>
  <friends><name>bar</name></name><name>baz</name></friends>
</people>

Into:

<user version="2" otherProp="prop">
  <login>foo</login>
  <knows><
name>bar</name></name><name>baz</name></knows>
</user>

And I just don't know how to start...

If some CssSel guru would mind to shore is knowledge...

Thanks !

-- 
Francois ARMAND
http://fanf42.blogspot.com
http://www.normation.com

David Pollak

unread,
Mar 6, 2012, 1:28:03 PM3/6/12
to lif...@googlegroups.com
On Tue, Mar 6, 2012 at 9:21 AM, Francois <fan...@gmail.com> wrote:
Hello guys,

I still don't master CssSelector transformation.

I would like to use them to transform something like:

<people version="1"
otherProp="prop">
  <name>foo</name>
  <friends><name>bar</name></name><name>baz</name></friends>
</people>

Into:

<user version="2" otherProp="prop">
  <login>foo</login>
  <knows><
name>bar</name></name><name>baz</name></knows>
</user>

"people" #> ((ns: NodeSeq) => <user version="2">{
  val kids = ns.asInstanceOf[Elem].child
  ("name" #> ((ns: NodeSeq) => <login>{ns.asInstanceOf[Elem].child}</login>)).apply(kids)
  }</user>)
 

And I just don't know how to start...

If some CssSel guru would mind to shore is knowledge...

Thanks !

-- 
Francois ARMAND
http://fanf42.blogspot.com
http://www.normation.com

--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code



--
Visi.Pro, Cloud Computing for the Rest of Us http://visi.pro
Lift, the simply functional web framework http://liftweb.net


Diego Medina

unread,
Mar 6, 2012, 1:59:09 PM3/6/12
to lif...@googlegroups.com
>
> "people" #> ((ns: NodeSeq) => <user version="2">{
>   val kids = ns.asInstanceOf[Elem].child
>   ("name" #> ((ns: NodeSeq) =>
> <login>{ns.asInstanceOf[Elem].child}</login>)).apply(kids)
>   }</user>)
>

This was too good to let it get lost in the mailing list archives, I
added it to this wiki
http://www.assembla.com/spaces/liftweb/wiki/Binding_via_CSS_Selectors
under "Replace tags, keep content"


Thanks

Diego

--
Diego Medina
Lift/Scala Developer
di...@fmpwizard.com
http://www.fmpwizard.com

David Pollak

unread,
Mar 6, 2012, 2:02:46 PM3/6/12
to lif...@googlegroups.com
I think this should be easier... Francois, can you open a ticket at http://ticket.liftweb.net and assign it to me to add something to the CSS selector transforms to make re-wrapping an Elem easier?

Francois

unread,
Mar 8, 2012, 5:09:23 AM3/8/12
to lif...@googlegroups.com, David Pollak
On 06/03/2012 20:02, David Pollak wrote:
> I think this should be easier... Francois, can you open a ticket at
> http://ticket.liftweb.net and assign it to me to add something to the
> CSS selector transforms to make re-wrapping an Elem easier?

Well, sorry for the delay... I do open the ticket:
https://github.com/lift/framework/issues/1236
But I don't know how to assign a version, assignee, or other information
(I don't seem to be able to drag and drop tags to the issue)... Sorry
for the inconvenience.

Reply all
Reply to author
Forward
0 new messages